上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页
摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2020-07-02 10:13 whatyouthink 阅读(95) 评论(0) 推荐(0) 编辑
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: Input: 阅读全文
posted @ 2020-07-02 10:06 whatyouthink 阅读(83) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers arr, replace each element with its rank. The rank represents how large the element is. The rank has the following rules: Ra 阅读全文
posted @ 2020-07-02 09:53 whatyouthink 阅读(91) 评论(0) 推荐(0) 编辑
摘要: In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. 阅读全文
posted @ 2020-07-01 18:40 whatyouthink 阅读(108) 评论(0) 推荐(0) 编辑
摘要: We have an array A of integers, and an array queries of queries. For the i-th query val = queries[i][0], index = queries[i][1], we add val to A[index] 阅读全文
posted @ 2020-07-01 17:34 whatyouthink 阅读(95) 评论(0) 推荐(0) 编辑
摘要: Given a date, return the corresponding day of the week for that date. The input is given as three integers representing the day, month and year respec 阅读全文
posted @ 2020-07-01 11:51 whatyouthink 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column ind 阅读全文
posted @ 2020-07-01 11:30 whatyouthink 阅读(85) 评论(0) 推荐(0) 编辑
摘要: There are some chips, and the i-th chip is at position chips[i]. You can perform any of the two following types of moves any number of times (possibly 阅读全文
posted @ 2020-07-01 10:42 whatyouthink 阅读(127) 评论(0) 推荐(0) 编辑
摘要: A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if the m 阅读全文
posted @ 2020-07-01 09:51 whatyouthink 阅读(93) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers nums, you start with an initial positive value startValue. In each iteration, you calculate the step by step sum of startVa 阅读全文
posted @ 2020-06-29 19:55 whatyouthink 阅读(110) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页