摘要:
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文
posted @ 2016-09-12 06:41
Machelsky
阅读(124)
评论(0)
推荐(0)
摘要:
Write a function to find the longest common prefix string amongst an array of strings. Solution1: 思路:没有想到什么巧妙方法。就用recursion暴力硬做。发现只要想法对,recursion怎么做都能 阅读全文
posted @ 2016-09-12 06:31
Machelsky
阅读(165)
评论(0)
推荐(0)
摘要:
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2016-09-12 05:20
Machelsky
阅读(131)
评论(0)
推荐(0)
摘要:
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? Solution1: 思路:有cycle:1.循环退不出来2.有个节点被指两次。 阅读全文
posted @ 2016-09-12 04:35
Machelsky
阅读(112)
评论(0)
推荐(0)
摘要:
Determine whether an integer is a palindrome. Do this without extra space. Solution1: 思路:按题目的意思就是负数不能是palindrome。用reverse integer函数判断即可。 阅读全文
posted @ 2016-09-12 03:44
Machelsky
阅读(109)
评论(0)
推荐(0)