随笔分类 -  LeetCode Java

1 2 下一页
【Leetcode】Reverse Words in a String JAVA实现
摘要:一、题目描述Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".二、分析要注意几点:1、当字符串的头部或者尾部存... 阅读全文
posted @ 2014-10-22 20:20 月下美妞1314 阅读(215) 评论(0) 推荐(0)
【leetcode】Find Minimum in Rotated Sorted Array II JAVA实现
摘要:一、题目描述Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose ... 阅读全文
posted @ 2014-10-22 18:57 月下美妞1314 阅读(773) 评论(0) 推荐(0)
【leetcode】Find Minimum in Rotated Sorted Array JAVA实现
摘要:一、题目描述Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element... 阅读全文
posted @ 2014-10-17 22:08 月下美妞1314 阅读(1055) 评论(0) 推荐(0)
【Leetcode】Reorder List JAVA
摘要:一、题目描述Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.Fo... 阅读全文
posted @ 2014-10-04 14:57 月下美妞1314 阅读(219) 评论(0) 推荐(0)
【Leetcode】Evaluate Reverse Polish Notation JAVA
摘要:一、问题描述Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another ... 阅读全文
posted @ 2014-10-02 22:30 月下美妞1314 阅读(205) 评论(0) 推荐(0)
【Leetcode】Insertion Sort List JAVA实现
摘要:1 阅读全文
posted @ 2014-09-29 00:45 月下美妞1314 阅读(131) 评论(0) 推荐(0)
【Leetcode】Sort List JAVA实现
摘要:Sort a linked list inO(nlogn) time using constant space complexity.1、分析该题主要考查了链接上的合并排序算法。2、正确代码实现package com.edu.leetcode;import com.edu.leetcode.List... 阅读全文
posted @ 2014-09-28 23:36 月下美妞1314 阅读(1024) 评论(0) 推荐(0)
Maximum Product Subarray JAVA实现
摘要:题目描述:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,... 阅读全文
posted @ 2014-09-25 10:22 月下美妞1314 阅读(350) 评论(0) 推荐(0)
Permutations java实现
摘要:Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,... 阅读全文
posted @ 2014-07-08 23:44 月下美妞1314 阅读(427) 评论(0) 推荐(0)
Binary Tree Level Order Traversal java实现
摘要:Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2... 阅读全文
posted @ 2014-07-08 22:53 月下美妞1314 阅读(207) 评论(0) 推荐(0)
Symmetric Tree
只有注册用户登录后才能阅读该文。
posted @ 2014-04-23 13:38 月下美妞1314 阅读(2) 评论(0) 推荐(0)
Sort Colors
只有注册用户登录后才能阅读该文。
posted @ 2014-04-15 17:09 月下美妞1314 阅读(1) 评论(0) 推荐(0)
Remove Duplicates from Sorted Array
只有注册用户登录后才能阅读该文。
posted @ 2014-03-28 16:19 月下美妞1314 阅读(4) 评论(0) 推荐(0)
Convert Sorted Array to Binary Search Tree
只有注册用户登录后才能阅读该文。
posted @ 2014-03-26 17:35 月下美妞1314 阅读(1) 评论(0) 推荐(0)
Linked List Cycle
只有注册用户登录后才能阅读该文。
posted @ 2014-03-26 17:31 月下美妞1314 阅读(3) 评论(0) 推荐(0)
Climbing Stairs
只有注册用户登录后才能阅读该文。
posted @ 2014-03-26 17:29 月下美妞1314 阅读(2) 评论(0) 推荐(0)
Merge Sorted Array
只有注册用户登录后才能阅读该文。
posted @ 2014-03-26 17:28 月下美妞1314 阅读(1) 评论(0) 推荐(0)
Balanced Binary Tree
只有注册用户登录后才能阅读该文。
posted @ 2014-03-26 17:27 月下美妞1314 阅读(1) 评论(0) 推荐(0)
Populating Next Right Pointers in Each Node
只有注册用户登录后才能阅读该文。
posted @ 2014-03-17 15:23 月下美妞1314 阅读(1) 评论(0) 推荐(0)
Merge Two Sorted 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注:实现这题我想了两种方法,1、将ListNode l2中的结点依次插入到l1中去,每次插入后使l1还是有序的2、使用归并排序在链表上实现的思想1、/** * Definition for singly-linked list. * public class ListNode { * int val; * ... 阅读全文
posted @ 2014-03-16 22:05 月下美妞1314 阅读(136) 评论(0) 推荐(0)

1 2 下一页