摘要: Question:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: ... 阅读全文
posted @ 2015-07-13 22:40 Maydow 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Question:Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1i2[i]) return 1; else if(i1[i... 阅读全文
posted @ 2015-07-13 22:08 Maydow 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 在java.lang包中有String.split()方法,返回是一个数组我在应用中用到一些,给大家总结一下,仅供大家参考:1、如果用“.”作为分隔的话,必须是如下写法,String.split("\\."),这样才能正确的分隔开,不能用String.split(".");2、如果用“|”作为分隔的... 阅读全文
posted @ 2015-07-13 21:44 Maydow 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Question:Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ...... 阅读全文
posted @ 2015-07-13 21:25 Maydow 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Question:Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume tha... 阅读全文
posted @ 2015-07-13 20:49 Maydow 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Question:Related to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For examp... 阅读全文
posted @ 2015-07-13 20:31 Maydow 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Question:Given an integern, return the number of trailing zeroes inn!.1、题型分类:2、思路:寻找n!后面的0的个数,即有多少个2*5,从而需要寻找里面总共有多少个2和多少个5,2肯定比5多,则只要找出5的个数即可。n/5是从n/... 阅读全文
posted @ 2015-07-13 20:25 Maydow 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Question:Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].1、题型分类:... 阅读全文
posted @ 2015-07-13 19:58 Maydow 阅读(112) 评论(0) 推荐(0) 编辑
摘要: Question:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100)... 阅读全文
posted @ 2015-07-13 19:37 Maydow 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Question:1、题型分类:2、思路:3、时间复杂度:4、代码:5、优化:6、扩展: 阅读全文
posted @ 2015-07-13 19:01 Maydow 阅读(234) 评论(0) 推荐(0) 编辑
摘要: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in... 阅读全文
posted @ 2015-07-13 18:59 Maydow 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 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 yo... 阅读全文
posted @ 2015-07-13 18:49 Maydow 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer... 阅读全文
posted @ 2015-07-13 16:39 Maydow 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文
posted @ 2015-07-13 16:19 Maydow 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Description:Count the number of prime numbers less than a non-negative number,n.思路:一个一个判断,时间复杂度:O(n^2)代码:TLEpublic class Solution { public int coun... 阅读全文
posted @ 2015-07-13 15:38 Maydow 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a ... 阅读全文
posted @ 2015-07-13 14:45 Maydow 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Reverse a singly linked list.思路:新建一个ListNode,最后返回这个ListNode.next。中间使用两个临时指针一个指向原来的链表头,一个指向新的链表的next.每次循环都往里面插入新的tempNode.时间复杂度:O(n)代码: public ListN... 阅读全文
posted @ 2015-07-13 13:39 Maydow 阅读(108) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[i] = nums[j]and the d... 阅读全文
posted @ 2015-07-13 09:49 Maydow 阅读(154) 评论(0) 推荐(0) 编辑