- 博客(24)
- 收藏
- 关注
原创 Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.
2015-06-29 09:35:32 222
原创 Unique Binary Search Trees
Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?For example, Given n = 3, there are a total of 5 unique BST’s. 1 3 3 2 1 \ /
2015-06-26 17:01:06 311
原创 Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2].Note: Recursive solution is trivial, could yo
2015-06-25 14:56:44 213
原创 java模拟linux命令scp
要导入包ganymed-ssh2-build210.jarpackage testScp; import java.io.IOException;import ch.ethz.ssh2.Connection; import ch.ethz.ssh2.SCPClient;public class Scp {/** * @param args */ public static voi
2015-06-25 10:32:33 725
原创 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 / 3 return [1,2,3].思路:需要借助栈,由于是前序遍历二叉树,肯定是左子树先于右子树被访问,由
2015-06-25 10:29:07 319
原创 Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and
2015-06-24 15:04:27 300
原创 eclipse中tomcat插件出现OutOfMemoryError错误的解决办法
maven项目pom文件配置tomcat插件,遇到如下问题:java.lang.OutOfMemoryError: PermGen space 解决办法:右键单击要运行的项目名称–>run as–>Run configurations–>选择你要运行的maven命令,比如我选择的是tomcat_run命令选择JRE 在VM arguments 里面加入如下命令:-Xms512m -Xmx512m
2015-06-23 15:45:08 435
原创 Best Time to Buy and Sell Stock
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 stock), desi
2015-06-22 19:48:32 319
原创 Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example:1 -> A2 -> B3 -> C...26 -> Z27 -> AA28 -> AB 思路:public class Solution { public String
2015-06-18 14:38:14 437
原创 ssoadm创建IDP和SP
openam版本为 13.0.0 ssoadm tools工具的版本是 12.0.0 创建信任环 ssoadm ^ create-cot ^ –cot cot1 ^ –adminid amadmin ^ –password-file d:\tmp\pwd.txt ^ –realm /生成IDP的元数据文件: ssoadm ^ create-metadata-templ ^
2015-06-17 17:19:37 2472
原创 String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca
2015-06-16 18:27:58 291
原创 Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.public class Solution { public int trailingZeroes(int n) {
2015-06-12 19:11:30 278
原创 Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?思路:求f(n)实际上可以转化为求f(n-1)和f(n-
2015-06-11 20:27:24 247
原创 Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is
2015-06-11 19:21:40 215
原创 Contains Duplicate II
Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between iand j is at most
2015-06-11 17:34:40 243
原创 Excel Sheet Column Number
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...
2015-06-11 16:51:44 254
原创 House Robber
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 adjacent house
2015-06-11 11:32:33 249
原创 Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,#,15,7}, 3
2015-06-10 14:58:18 235
原创 Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20
2015-06-10 14:53:17 203
原创 Maximum Depth of Binary Tree
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 leaf node./** * Definition for a bina
2015-06-06 17:53:06 207
原创 Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node思路:求一棵树的最小深度可以转化为求左子树和右子树的最小深度,然后加上
2015-06-06 17:39:00 259
原创 Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe
2015-06-06 15:53:42 232
原创 Plus One
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 listpublic class Solution
2015-06-05 18:23:29 236
原创 Combination Sum III
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Ensure that numbers wi
2015-06-01 14:50:56 219
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人