leetcode
SneakyRogue
这个作者很懒,什么都没留下…
展开
-
9. Palindrome Number(回文数)
9.Palindrome Number Determine whether an integer is a palindrome. An integerisapalindrome when itreads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -...原创 2019-04-10 20:07:18 · 150 阅读 · 0 评论 -
1.Two Sum
leetcode第一题 Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1] 最初是的遍历两次,把两个相同的值进行去比较获得答案,可以通过速度较慢。 //一开始的个人做法 class Solution { public int[] twoSum(in...原创 2019-04-08 20:59:39 · 124 阅读 · 0 评论 -
贪吃的小q
牛客题目https://www.nowcoder.com/questionTerminal/d732267e73ce4918b61d9e3d0ddd9182?orderByHotValue=1&page=1&onlyReference=false小Q的父母要出差N天,走之前给小Q留下了M块巧克力。小Q决定每天吃的巧克力数量不少于前一天吃的一半,但是他又不想在父母回来之前的某一天没有...原创 2019-04-15 20:44:53 · 231 阅读 · 0 评论 -
2. Add Two Numbers
2.Add Two Numbers Example: Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)Output: 7 -> 0 -> 8Explanation: 342 + 465 = 807. 一开始提供了ListNode 这个list, .val转化出来的值就是个int, 比如l1.val == 243, .n...原创 2019-04-09 21:04:38 · 200 阅读 · 0 评论 -
6. ZigZag Conversion
The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I...原创 2019-04-28 21:18:01 · 158 阅读 · 0 评论 -
5. Longest Palindromic Substring
Given a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Exa...原创 2019-04-25 09:14:36 · 120 阅读 · 0 评论 -
7. Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dea...原创 2019-04-29 21:02:24 · 128 阅读 · 0 评论