2015年11月25日

Merge Sorted Array

摘要: 问题描述Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is g... 阅读全文

posted @ 2015-11-25 21:21 qiaoshanzi 阅读(120) 评论(0) 推荐(0) 编辑

Add Binary

摘要: 问题描述Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".算法代码一 1 public String addBinary(String a, S... 阅读全文

posted @ 2015-11-25 16:27 qiaoshanzi 阅读(108) 评论(0) 推荐(0) 编辑

2015年11月16日

Java笔记之String

摘要: 1.1 String s="a",t="b";2 t.concat(s);之后,t仍然是"b",而不是"ba",要使t是"ba"则String s="a",t="b";t=t.concat(s); 阅读全文

posted @ 2015-11-16 22:47 qiaoshanzi 阅读(88) 评论(0) 推荐(0) 编辑

Java笔记之数组

摘要: 1.int flags[] = new int[10];数组中的每个元素初始化为0. Arrays.fill(flags, 0);将数组中每个元素置为0. 阅读全文

posted @ 2015-11-16 22:43 qiaoshanzi 阅读(102) 评论(0) 推荐(0) 编辑

2015年11月11日

Merge Two Sorted Lists

摘要: 问题描述Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.算法代码一... 阅读全文

posted @ 2015-11-11 15:22 qiaoshanzi 阅读(104) 评论(0) 推荐(0) 编辑

Remove Nth Node From End of List

摘要: 问题描述Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After ... 阅读全文

posted @ 2015-11-11 14:02 qiaoshanzi 阅读(134) 评论(0) 推荐(0) 编辑

2015年11月10日

Longest Common Prefix

摘要: 问题描述Write a function to find the longest common prefix string amongst an array of strings.算法代码一 1 public String longestCommonPrefix(String [] strs){ 2... 阅读全文

posted @ 2015-11-10 23:05 qiaoshanzi 阅读(152) 评论(0) 推荐(0) 编辑

2015年11月4日

Roman to Integer

摘要: 问题描述Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.算法代码一: 1 public int romanToInt(String s)... 阅读全文

posted @ 2015-11-04 19:03 qiaoshanzi 阅读(137) 评论(0) 推荐(0) 编辑

2015年11月3日

Palindrome Number

摘要: 问题描述Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are th... 阅读全文

posted @ 2015-11-03 22:38 qiaoshanzi 阅读(129) 评论(0) 推荐(0) 编辑

2015年10月30日

Reverse Integer

摘要: 问题描述Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321算法代码一: 1 public int reverse(int x) { 2 long rev= 0;... 阅读全文

posted @ 2015-10-30 13:09 qiaoshanzi 阅读(472) 评论(0) 推荐(0) 编辑

导航