摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2018-03-18 21:35 还是说得清点吧 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2018-03-18 20:47 还是说得清点吧 阅读(158) 评论(0) 推荐(0) 编辑
摘要: We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). N 阅读全文
posted @ 2018-03-18 19:46 还是说得清点吧 阅读(336) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2018-03-18 19:01 还是说得清点吧 阅读(123) 评论(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. For example, giv 阅读全文
posted @ 2018-03-18 16:06 还是说得清点吧 阅读(95) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2018-03-18 12:47 还是说得清点吧 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The length 阅读全文
posted @ 2018-03-17 20:58 还是说得清点吧 阅读(217) 评论(1) 推荐(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 @ 2018-03-17 20:54 还是说得清点吧 阅读(368) 评论(1) 推荐(0) 编辑
摘要: 之前有刷过一些题,但都坚持不下去,现在搞个小博客,希望自己能坚持下去吧~~ In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with diff 阅读全文
posted @ 2018-03-17 20:49 还是说得清点吧 阅读(144) 评论(2) 推荐(0) 编辑