随笔分类 -  leetcode

摘要:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below a... 阅读全文
posted @ 2015-10-29 18:49 dylqt 阅读(214) 评论(0) 推荐(0)
摘要:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are s... 阅读全文
posted @ 2015-10-29 16:42 dylqt 阅读(116) 评论(0) 推荐(0)
摘要:Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki... 阅读全文
posted @ 2015-10-29 13:41 dylqt 阅读(133) 评论(0) 推荐(0)
摘要:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".char* addBinary(char* a, char* b) { int a... 阅读全文
posted @ 2015-10-26 17:20 dylqt 阅读(146) 评论(0) 推荐(0)
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F 阅读全文
posted @ 2015-10-11 21:38 dylqt 阅读(148) 评论(0) 推荐(0)
摘要:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文
posted @ 2015-10-11 21:13 dylqt 阅读(139) 评论(0) 推荐(0)
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists:A: a1 → a2 ↘ ... 阅读全文
posted @ 2015-09-25 21:19 dylqt 阅读(131) 评论(0) 推荐(0)
摘要:Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 -->... 阅读全文
posted @ 2015-09-25 10:43 dylqt 阅读(132) 评论(0) 推荐(0)
摘要:Reverse a singly linked list./** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct Li... 阅读全文
posted @ 2015-09-25 08:51 dylqt 阅读(143) 评论(0) 推荐(0)
摘要:一、题目Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't... 阅读全文
posted @ 2015-09-23 09:04 dylqt 阅读(135) 评论(0) 推荐(0)
摘要:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2015-09-22 09:54 dylqt 阅读(203) 评论(0) 推荐(0)