
LeetCode
LILI-XU
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode 145 Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [3,2,1]. Note: Recursive solut原创 2015-03-25 06:54:55 · 591 阅读 · 0 评论 -
LeetCode 19 Remove Nth Node From End of List
# Definition for singly-linked list. # class ListNode # attr_accessor :val, :next # def initialize(val) # @val = val # @next = nil # end # end # @param {ListNode} head # @原创 2015-03-14 01:47:49 · 456 阅读 · 0 评论 -
LeetCode 100 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. # Definition原创 2015-03-11 07:35:14 · 352 阅读 · 0 评论 -
LeetCode 136 Single Number
Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using e原创 2015-03-11 07:30:16 · 430 阅读 · 0 评论 -
LeetCode 191 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 000000原创 2015-03-11 07:36:54 · 452 阅读 · 0 评论 -
LeetCode 104 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. # Definition for a binary tree no原创 2015-03-11 07:33:20 · 416 阅读 · 0 评论 -
LeetCode 89 Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total number of bits in the code, print the sequence of原创 2015-03-27 02:11:26 · 715 阅读 · 0 评论 -
LeetCode 75 Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the integers原创 2015-03-27 01:16:33 · 696 阅读 · 0 评论 -
LeetCode 121 Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),原创 2015-03-25 06:59:58 · 735 阅读 · 0 评论 -
LeetCode 2 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 as a link原创 2015-03-15 05:21:45 · 863 阅读 · 0 评论 -
LeetCode 190 Reverse Bits
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010原创 2015-03-14 02:04:18 · 1128 阅读 · 0 评论