- 博客(8)
- 收藏
- 关注
原创 [LeetCode 151] Reverse Words in a String
Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". 语言使用python: 整体思路:使用spilit()函数把以空格区分的字符串列表分割 然后倒置列表,最后写入字符串中并且添加空格
2016-04-25 16:35:11 382
原创 [LeetCode 338] Counting Bits
LeetCode 338. Counting Bits Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an ar
2016-04-24 13:24:12 526
原创 [LeetCode 238] Product of Array Except Self
题目: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Solve it without division
2016-04-04 15:48:56 549
原创 [LeetCode 7] Reverse Integer
题目: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 我自己的代码,有点混乱而且没有考虑溢出情况,没有AC; int reverse(int x) { int length = 0; int res[32], resul
2016-04-03 15:12:10 398
原创 LeetCode 82 Remove Duplicates from Sorted List II
题目: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example, Given 1->2->3->3->4->4->5, return 1->2->5. Gi
2016-04-02 21:59:08 222
原创 LeetCode 83 Remove Duplicates from Sorted List
题目: Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3 AC不过,但是经过自己代码测试发现
2016-04-02 15:43:03 242
原创 [LeetCode 326] Power of Three
题目: Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any loop / recursion?(更进一步,是否能不使用循环和递归) 递归做法: bool isPowerOfThree
2016-04-01 16:15:38 292
原创 LeetCode 3 Longest Substring Without Repeating Characters
题目: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length
2016-04-01 15:34:18 217
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人