
LeetCode
Anonymous_cx
这个作者很懒,什么都没留下…
展开
-
Reverse Words in a String
Given an input string, reverse the string word by word.For example, Given s = "the sky is blue", return "blue is sky the".code:public class ReverseString { public static void main(String[] args) {原创 2016-09-11 12:50:49 · 408 阅读 · 0 评论 -
Invert Binary Tree
Question: 4 / \ 2 7 / \ / \ 1 3 6 9to 4 / \ 7 2 / \ / \ 9 6 3 1code:class TreeNode { int key; String data; TreeNode left; TreeNode right;原创 2016-09-13 09:20:38 · 353 阅读 · 0 评论 -
Move Zeroes
Question: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], after calling y原创 2016-09-13 19:12:06 · 444 阅读 · 0 评论 -
House Robber
Question:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjace原创 2016-09-16 21:44:08 · 422 阅读 · 0 评论 -
Valid Anagram
Question: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: You may ass原创 2016-09-17 11:00:25 · 414 阅读 · 0 评论 -
Best Time to Buy and Sell Stock
Question: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 sto原创 2016-09-21 14:47:22 · 720 阅读 · 0 评论