- 博客(20)
- 资源 (3)
- 收藏
- 关注
原创 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 as a
2014-04-26 14:42:45 524
原创 LeetCode: Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".这个题目直接用
2014-04-26 14:39:44 343
原创 LeetCode: Permutation Sequence
/*The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""2
2014-04-26 14:36:51 477
原创 LeetCode: Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.使用ha'sh
2014-04-08 01:51:08 885
原创 LeetCode: Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321
2014-04-08 01:46:05 440
原创 LeetCode: Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from th
2014-04-08 01:43:40 462
原创 LeetCode: Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2,
2014-04-08 01:40:47 438
原创 LeetCode: Merge two sorted linked lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
2014-04-05 14:42:28 449
原创 LeetCode: Remove Duplicates from Sorted List
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place wi
2014-04-05 14:35:14 294
原创 LeetCode: Linked_List_Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?
2014-04-05 13:54:39 354
原创 LeetCode: Linked List Cycle
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?
2014-04-05 13:53:07 269
原创 Leetcode: Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.此题用递归的方法,首先找到数组中的中值作为root,之后把中值左边的和右边的数组作为新数组分别做递归。/** * Definition for binary tree * publi
2014-04-05 13:50:36 328
原创 Leetcode: Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive solutio
2014-04-05 13:48:17 335
原创 Leetcode: 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 / 3return [3,2,1].Note: Recursive so
2014-04-05 13:42:19 377
原创 Leetcode: 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.此处分析参考了http://mp.weixin.qq.com/mp/
2014-04-03 04:03:27 480
原创 Leetcode: Balanced Binary Tree
从今天起逐渐把我做过的leetcode题目放上来。Balanced Binary TreeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate e
2014-04-03 03:57:47 420
原创 贪吃蛇的java程序
import java.awt.*;import javax.swing.*;import java.awt.event.*;public class Snake extends JFrame { private SnakePanel snakePanel = new SnakePanel(); private static final long serialV
2012-04-17 14:16:00 413
原创 扫雷的java程序
import java.awt.*;import java.awt.event.*;import javax.swing.*;public class JMinesweeper extends JFrame { private int row = 10; private int column = 10; private int bombsNumbe
2012-04-17 14:13:23 448
原创 一个五子棋的java程序
import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Gomoku extends JFrame { privatefinal int CHESSBOARD_SIZE = 15; privateJLabel jblWhite = new JLabel("Whit
2012-04-17 14:11:52 750
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人