代码改变世界

[LeetCode] 504. Base 7_Easy tag: Math

2018-08-20 08:47 by Johnson_强生仔仔, 178 阅读, 0 推荐, 收藏, 编辑
摘要:Given an integer, return its base 7 string representation. Example 1: Example 2: Note: The input will be in range of [-1e7, 1e7]. 不停除以7, 然后把余数放到ans里面, 阅读全文

[LeetCode] 830. Positions of Large Groups_Easy tag: Two Pointers

2018-08-20 03:56 by Johnson_强生仔仔, 183 阅读, 0 推荐, 收藏, 编辑
摘要:In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy" has the g 阅读全文

[LeetCode] 586. Customer Placing the Largest Number of Orders_Easy tag;SQL

2018-08-20 03:36 by Johnson_强生仔仔, 839 阅读, 0 推荐, 收藏, 编辑
摘要:Query the customer_number from the orders table for the customer who has placed the largest number of orders. It is guaranteed that exactly one custom 阅读全文

[LeetCode] 824. Goat Latin_Easy

2018-08-20 03:14 by Johnson_强生仔仔, 135 阅读, 0 推荐, 收藏, 编辑
摘要:A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the 阅读全文

[LeetCode] 596. Classes More Than 5 Students_Easy tag:SQL

2018-08-20 03:03 by Johnson_强生仔仔, 179 阅读, 0 推荐, 收藏, 编辑
摘要:There is a table courses with columns: student and class Please list out all classes which have more than or equal to 5 students. For example, the tab 阅读全文

[LeetCode] 744. Find Smallest Letter Greater Than Target_Easy tag: Binary Search

2018-08-20 02:46 by Johnson_强生仔仔, 171 阅读, 0 推荐, 收藏, 编辑
摘要:Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list t 阅读全文

[LeetCode] 414. Third Maximum Number_Easy

2018-08-20 02:33 by Johnson_强生仔仔, 184 阅读, 0 推荐, 收藏, 编辑
摘要:Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexi 阅读全文

[LeetCode] 696. Count Binary Substrings_Easy

2018-08-20 02:09 by Johnson_强生仔仔, 253 阅读, 0 推荐, 收藏, 编辑
摘要:利用group, 将每个连着的0或者1计数并且append进入group里面, 然后再将group里面的两两比较, 得到min, 并且加入到ans即可. T: O(n) S: O(n) 比较好理解 improve: 思路相同, 用pre和cur去将space节省到O(1) Code 1) T: O( 阅读全文

[LeetCode] 709. To Lower Case_Easy

2018-08-20 01:47 by Johnson_强生仔仔, 227 阅读, 0 推荐, 收藏, 编辑
摘要:Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" 阅读全文

[LeetCode] 581. Shortest Unsorted Continuous Subarray_Easy tag: Sort, Stack

2018-08-20 01:37 by Johnson_强生仔仔, 196 阅读, 0 推荐, 收藏, 编辑
摘要:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 39 下一页