- 博客(16)
- 收藏
- 关注
原创 LeetCode-273. Integer to English Words
Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1. For example, 123 -> "One Hundred Twenty Three" 12345 -> "Twelve Thousand Thre
2017-04-16 21:44:07 275
原创 LeetCode-419. Battleships in a Board
Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules: You receive a valid
2017-04-16 20:54:53 263
原创 LeetCode-138. Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. Hash Table /** * Definitio
2017-04-16 20:41:13 246
原创 LeetCode-206. Reverse Linked List
206. Reverse Linked List Reverse a singly linked list. 用循环的方式: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val
2017-04-14 15:04:29 269
原创 LeetCode-94(Binary Tree Inorder Traversal)
Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,3,2]. Note: Recursive solu
2017-04-03 16:09:46 200
原创 LeetCode-10(回文检测)
Determine whether an integer is a palindrome. Do this without extra space. class Solution { public: bool isPalindrome(int x) { if(x<0 || (x!=0 && x%10==0)) return false; //个位是0肯定不是回
2017-04-03 15:42:11 331
原创 LeetCode-8(String to Integer (atoi))
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 and ask yourself what are the possible input ca
2017-04-03 15:30:02 246
原创 LeetCode-7(Reverse Integer)
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers. Note: The input is assumed to be a 32-bit signed integer. Your function s
2017-04-03 11:38:49 419
原创 LeetCode-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
2017-04-03 10:47:12 312
原创 LeetCode-5*(回文)
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid answer.
2017-04-03 10:02:56 266
原创 LeetCode-4*
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 =
2017-04-03 00:30:40 262
原创 LeetCode-3*
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 answer is "
2017-04-02 11:58:33 222
原创 leetcode-2
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i
2017-04-02 09:27:08 330
原创 leetcode-1
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the sam
2017-04-02 08:55:15 224
原创 leetcode-24
Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space. Y
2017-04-02 08:46:19 229
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人