摘要: problem: first: result: second try: result: 换成StringBuffer,效果竟然一样?? 3nd: result: 可见,用数组代替string和StringBuffer或StringBuilder会更快。 4th: result: conclusion 阅读全文
posted @ 2018-04-25 19:40 Zhao_Gang 阅读(59) 评论(0) 推荐(0) 编辑
摘要: problem: first: result: Submission Result: Wrong Answer Input: "RLUURDDDLU" Output: false 2: result: 参考答案: result: retry: result: conclusion: 可见把Strin 阅读全文
posted @ 2018-04-25 19:05 Zhao_Gang 阅读(78) 评论(0) 推荐(0) 编辑
摘要: problem: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The 阅读全文
posted @ 2018-04-24 09:47 Zhao_Gang 阅读(92) 评论(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 阅读全文
posted @ 2018-04-21 15:12 Zhao_Gang 阅读(94) 评论(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, 阅读全文
posted @ 2018-04-20 16:20 Zhao_Gang 阅读(69) 评论(0) 推荐(0) 编辑
摘要: question: question: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1 Ex 阅读全文
posted @ 2018-04-19 21:48 Zhao_Gang 阅读(82) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2018-04-19 14:34 Zhao_Gang 阅读(85) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t 阅读全文
posted @ 2018-04-19 13:57 Zhao_Gang 阅读(98) 评论(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 阅读全文
posted @ 2018-04-18 10:52 Zhao_Gang 阅读(91) 评论(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, 阅读全文
posted @ 2018-04-18 10:13 Zhao_Gang 阅读(91) 评论(0) 推荐(0) 编辑