- 博客(11)
- 资源 (4)
- 收藏
- 关注
原创 member access within misaligned address 0x000000000031 for type 'struct ListNode', which requires 8
错误提示:member access within misaligned address 0x000000000031 for type 'struct ListNode', which requires 8 byte alignment原因分析:在链表中,链表节点定义如下:Definition for singly-linked list. * struct ListNod
2017-01-23 00:15:24 17817 5
原创 【C语言】LeetCode 234. Palindrome Linked List
题目:Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?解法:/** * Definition for singly-linked list. * struct ListNode {
2017-01-16 17:05:04 860
原创 【C语言】 LeetCode 400. Nth Digit
题目:Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...Note:n is positive and will fit within the range of a 32-bit signed integer (n 31).Example
2017-01-07 23:24:01 376
原创 【C语言】LeetCode 345. Reverse Vowels of a String
题目:Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotcede"
2017-01-06 14:05:24 546
原创 【C语言】LeetCode 7. Reverse Integer
题目:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321解答://int越界,C++中的int类型存储长度为32bit.所以范围是“-2^32”到“2^32-1”;也就是“-2147483648”到“2147483647”,因此将int数值反转后可能会造成越界。 int...
2017-01-06 14:02:40 827
原创 【C语言】LeetCode 3. Longest Substring Without Repeating Characters
题目:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the an
2017-01-06 13:59:49 2609
原创 【C语言】LeetCode 468. Validate IP Address
题目:Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.IPv4 addresses are canonically represented in dot-decimal notation, which consists of
2017-01-06 13:58:08 518
原创 【C语言】LeetCode 165. Compare Version Numbers
题目:Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-emp
2017-01-06 13:56:26 378
原创 【C语言】 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".Update (2015-02-12):For C programmers: Try to solve it in
2017-01-06 13:54:35 903
原创 【C语言】 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?方法一:由于整形存储有大小限制,利用其大小限制可以快速求解。(一般用32位,4个字节)
2017-01-06 13:45:09 350
原创 【C语言】 leetcode 453. Minimum Moves to Equal Array Elements
题目Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1.Example:Input:[1,
2017-01-05 18:52:34 402
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人