
LeetCode
文章平均质量分 78
Iron_Tie
足够优秀再去爱你~
展开
-
LeetCode------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.题目的意识是给一个已经排好序链表,删除重复的元素。原创 2016-05-07 20:09:48 · 528 阅读 · 0 评论 -
LeetCode------Move Zeroes
题目简介Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], aft原创 2016-04-24 19:47:24 · 384 阅读 · 0 评论 -
LeetCode------Invert Binary Tree
题目简介Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by this original tweet原创 2016-04-21 21:15:04 · 525 阅读 · 0 评论 -
LeetCode------Maximum Depth of Binary Tree
题目简介Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.自己的解法原创 2016-04-20 21:35:05 · 513 阅读 · 0 评论 -
LeetCode------Add Digits
题目简介Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Si原创 2016-04-19 20:52:38 · 418 阅读 · 0 评论 -
LeetCode------Nim Game
题目介绍You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone w原创 2016-04-18 20:32:04 · 430 阅读 · 0 评论 -
LeetCode------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 NA P L S原创 2016-04-17 21:25:15 · 543 阅读 · 0 评论 -
LeetCode------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 answer is "原创 2016-04-16 21:31:12 · 521 阅读 · 0 评论 -
LeetCode------Two Sum
题目说明Given an array of integers, return indices of the two numbers such that they add up to a specific target. 给定一个整数的数组,将它们添加到一个特定的目标的2个数字的返回值。 You may assume that each input would have exactl原创 2016-04-05 22:04:32 · 283 阅读 · 0 评论 -
LeetCode------Majority Element
题目简介Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element always exist in the array.题目的意思是找出一个数组中出现次数超过⌊ n/2 ⌋次原创 2016-05-06 22:13:13 · 420 阅读 · 0 评论 -
LeetCode------Climbing Stairs
题目简介You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?题目的意思就是一个数字n,你可以用1或2,总共有多少种组合方式原创 2016-05-05 22:19:01 · 566 阅读 · 0 评论 -
LeetCode------Linked List Cycle
题目简介Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题意就是让我们判断一个链表是否有循环,而且不能开辟额外的空间原创 2016-05-04 21:35:30 · 492 阅读 · 0 评论 -
LeetCode------Delete Node in a Linked List
题目简介Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third n原创 2016-04-25 20:31:49 · 474 阅读 · 0 评论 -
LeetCode------Same Tree
题目简介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 and the nodes have the same value.原创 2016-04-25 21:42:03 · 429 阅读 · 0 评论 -
LeetCode------Valid Anagram
题目简介Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note原创 2016-04-26 20:52:36 · 899 阅读 · 0 评论 -
LeetCode------Excel Sheet Column Number
题目介绍Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C ->原创 2016-04-28 12:24:44 · 470 阅读 · 0 评论 -
LeetCode------Contains Duplicate
题目简介Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if ever原创 2016-04-28 20:28:26 · 421 阅读 · 0 评论 -
LeetCode------Contains Duplicate
题目简介Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?自己的解法//原创 2016-04-29 21:24:04 · 379 阅读 · 0 评论 -
LeetCode------Roman to Integer
题目简介Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.原创 2016-05-01 21:54:55 · 400 阅读 · 0 评论 -
LeetCode------Lowest Common Ancestor of a Binary Search Tree
题目简介Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes v and w as the lowest node in T that has原创 2016-05-03 10:53:14 · 458 阅读 · 0 评论 -
LeetCode------Number of 1 Bits
题目简介Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 00000000000000000000000000001011, so the function should ret原创 2016-05-03 21:59:11 · 392 阅读 · 0 评论 -
LeetCode------Add Two Numbers
题目说明You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it原创 2016-04-07 20:29:00 · 361 阅读 · 0 评论