随笔分类 -  JAVA

摘要:Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv... 阅读全文
posted @ 2015-10-18 13:34 六层楼 阅读(708) 评论(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 @ 2015-10-17 18:23 六层楼 阅读(138) 评论(0) 推荐(0) 编辑
摘要:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ... 阅读全文
posted @ 2015-10-08 22:30 六层楼 阅读(153) 评论(0) 推荐(0) 编辑
摘要:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired bythis... 阅读全文
posted @ 2015-10-06 18:53 六层楼 阅读(152) 评论(0) 推荐(0) 编辑
摘要:Total Accepted:83663Total Submissions:200541Difficulty:EasyGiven two binary trees, write a function to check if they are equal or not.Two binary trees... 阅读全文
posted @ 2015-10-03 20:55 六层楼 阅读(177) 评论(0) 推荐(0) 编辑
摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is1 -> 2 -> 3 -> ... 阅读全文
posted @ 2015-09-24 21:03 六层楼 阅读(132) 评论(0) 推荐(0) 编辑
摘要:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... 阅读全文
posted @ 2015-09-23 20:56 六层楼 阅读(136) 评论(0) 推荐(0) 编辑
摘要:1 package test; 2 import java.awt.*; 3 import javax.swing.*; 4 import java.awt.event.*; 5 public class FrameDemo2 6 { 7 static JTextField field1=new ... 阅读全文
posted @ 2015-06-24 13:15 六层楼 阅读(852) 评论(0) 推荐(0) 编辑
摘要:1 import java.io.BufferedReader; 2 import java.io.FileNotFoundException; 3 import java.io.FileReader; 4 import java.io.IOException; 5 import java.io.... 阅读全文
posted @ 2015-06-22 22:27 六层楼 阅读(749) 评论(0) 推荐(0) 编辑