摘要: 第一部分:Array twoSum问题 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each 阅读全文
posted @ 2017-07-11 15:56 木子月月鸟 阅读(1683) 评论(0) 推荐(0) 编辑
摘要: 算是大概完成了这个学期初定下的目标,终于刷完了剑指offer的题目,尽管刷了一遍之后感觉自己大部分又忘记了,很明显又要再刷一遍,因此在此再立下一个小目标,在放假前将剑指offer二刷一半吧!!!这个博客就重新将之前做的剑指offer题目整理一下,感觉之前写的太乱了,就算是自己看,感觉以后也不舒服。 阅读全文
posted @ 2017-07-05 22:27 木子月月鸟 阅读(267) 评论(0) 推荐(0) 编辑
摘要: (41)String to Integer II 1 public class Solution { 2 /** 3 * @param str: A string 4 * @return An integer 5 */ 6 public int atoi(String str) { 7 if (st 阅读全文
posted @ 2017-07-03 16:55 木子月月鸟 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 1. Two Sum 第36行本来应该是if (nodes.get(left).key < nodes.get(right).key) { 一不小心误写成了if (nodes.get(left).key < nodes.get(right).value) { 竟然A了!!!! 572. Subtre 阅读全文
posted @ 2017-06-27 22:02 木子月月鸟 阅读(335) 评论(0) 推荐(0) 编辑
摘要: 排序算法: ①归并排序算法模板: 1 public class Solution { 2 public void sortInteger(int[] a) { 3 if (a == null || a.length == 0) { 4 return; 5 } 6 int[] temp = new i 阅读全文
posted @ 2017-06-06 15:08 木子月月鸟 阅读(211) 评论(0) 推荐(0) 编辑
摘要: (31)Digit Counts (比较蠢的做法,但是lintcode通过测试了) 1 class Solution { 2 /* 3 * param k : As description. 4 * param n : As description. 5 * return: An integer d 阅读全文
posted @ 2017-06-05 16:34 木子月月鸟 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 19. Remove Nth Node From End of List 1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next; 6 * List 阅读全文
posted @ 2017-05-24 22:42 木子月月鸟 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1 package hello; 2 import java.util.*; 3 4 public class Hello { 5 public static void main(String args[]){ 6 double[] a = produce(10000); 7 int[] b = t 阅读全文
posted @ 2017-05-24 10:56 木子月月鸟 阅读(300) 评论(0) 推荐(0) 编辑
摘要: (21)Binary Tree Postorder Traversal 1 /** 2 * Definition of TreeNode: 3 * public class TreeNode { 4 * public int val; 5 * public TreeNode left, right; 阅读全文
posted @ 2017-05-16 17:07 木子月月鸟 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 7.Reverse Integer 解题思路:使用强制类型转换的代码,先用long做,之后判断值然后强制转化成int 9. Palindrome Number 8. String to Integer (atoi) 1 public class Solution { 2 public int myA 阅读全文
posted @ 2017-04-25 21:29 木子月月鸟 阅读(211) 评论(0) 推荐(0) 编辑