摘要: Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 题目:给你丫一字符串,你给我倒着写。。。。 思路:我一开 阅读全文
posted @ 2016-07-14 14:20 Roger's 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 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, giv 阅读全文
posted @ 2016-07-14 14:08 Roger's 阅读(99) 评论(0) 推荐(0) 编辑
摘要: Invert a binary tree. to /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(i 阅读全文
posted @ 2016-07-14 13:54 Roger's 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 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 l 阅读全文
posted @ 2016-07-14 13:40 Roger's 阅读(94) 评论(0) 推荐(0) 编辑
摘要: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2016-07-14 13:34 Roger's 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Implement pow(x, n). 题目:求x的n次方 public class Solution { public double myPow(double x ,int n){ } } 解题感受:这道题目在leetcode上的Difficulty是Medium,其实也不比Easy难多少,除了 阅读全文
posted @ 2016-07-11 17:05 Roger's 阅读(576) 评论(0) 推荐(0) 编辑
摘要: Implement atoi to convert a string to an integer. Carefully consider all possible input cases. If you want a challenge, please do not see below and as 阅读全文
posted @ 2016-07-07 17:36 Roger's 阅读(668) 评论(0) 推荐(0) 编辑