- 博客(9)
- 资源 (10)
- 收藏
- 关注
原创 Binary Tree Right Side View —— Leetcode(精巧的方法,第二遍)
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary tree, 1
2015-05-06 21:55:56 1281
原创 Linked List Cycle —— Leetcode
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?这题大部分刷题书上都有,定义两个指针,一个快一个慢,快的每次走两步,慢的每次走一步,如下情况为有环情况:我的代码还是挺简洁的,如下:/** * D
2015-05-05 20:15:07 504
原创 Plus One —— Leetcode
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 the head of the list.注意点:1. insert的运用 2.
2015-05-04 16:57:48 456
原创 Add Binary —— Leetcode(重做)
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".这题不难,从后往前;难的是如何使代码变得更简洁,参考如下代码:class Solution {public: string addBinary(s
2015-05-04 16:23:23 457
原创 Remove Duplicates from Sorted List —— Leetcode
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.一次通过,自认为方法还是比较简洁的,关于头的定
2015-05-04 10:04:22 470
原创 Merge Sorted Array —— Leetcode
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fro
2015-05-03 21:15:45 447
原创 Count Primes —— Leetcode
Description:Count the number of prime numbers less than a non-negative number, nclick to show more hints.References:How Many Primes Are There?Sieve of Eratosthenes参考References第二个
2015-05-02 22:17:44 2861
原创 Symmetric Tree —— Leetcode
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f
2015-05-02 16:10:05 505
原创 Same Tree —— Leetcode
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.递归之下,简单的不能
2015-05-01 22:35:07 424
Cisco IP Routing: Packet Forwarding and Intra-domain Routing Protocols
2012-05-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人