討論串[閒聊] 每日LeetCode
共 719 篇文章
內容預覽:
之前每日寫過了. 今天再寫一次基本上長一模一樣. 238. Product of Array Except Self. class Solution {. public:. vector<int> productExceptSelf(vector<int>& nums) {. vector<int>
(還有416個字)
內容預覽:
一開始想說慢慢加上去. 找到比總和大的數就return. 後來發先要先加完再減才是對的. 2971. Find Polygon With the Largest Perimeter. class Solution {. public:. long long largestPerimeter(vect
(還有325個字)
內容預覽:
我看其他比我快的都是用2D array. 分成三個哈希表col row 3x3. 然後就看不懂了. 我好爛. 哈. 36. Valid Sudoku. class Solution {. public:. bool isValidSudoku(vector<vector<char>>& board)
(還有787個字)
內容預覽:
沒想到能用布林運算符來解題. 以前我一定就直接開map來解. 非常好布林. 136. Single Number. class Solution {. public:. int singleNumber(vector<int>& nums) {. int ans=0;. for(const int&
(還有12個字)
內容預覽:
https://leetcode.com/problems/find-polygon-with-the-largest-perimeter. 找出能做出最大多邊形邊長的數組,有則回傳周長,沒有則回傳-1. Python3 code:. --------------------------------
(還有802個字)