![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
l1Java学习
xbtkkk
这个作者很懒,什么都没留下…
展开
-
234. Parlindrome Linked List
Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?之前想过的一个方法是先将其看成是判断Parlindrome 的string来做,将Linked List里的数取出来转换成string来判断,但是有问题:一是linked原创 2016-07-14 14:30:12 · 328 阅读 · 0 评论 -
Zigzag
题目:The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H N A P L S I I原创 2016-07-08 18:57:49 · 195 阅读 · 0 评论 -
AddTwoNumber
题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a li原创 2016-07-08 11:02:01 · 305 阅读 · 0 评论 -
ReverseInteger
Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321除了考虑数字的翻转之外,还有溢出的判断。int 32bit -2147483648~21373836471st:public class Solution { public static int revers原创 2016-07-07 11:46:44 · 161 阅读 · 0 评论 -
TwoSum
题目: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1].try:public class Solution { public int[] twoSum(int[] nums, int target) { int sum=0;原创 2016-07-07 15:34:26 · 190 阅读 · 0 评论 -
83. Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3.pointer ->temp, when pointer cha原创 2016-07-28 11:11:34 · 158 阅读 · 0 评论 -
19. Remove Nth Node From End of List
题目: Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked li原创 2016-07-15 13:27:20 · 163 阅读 · 0 评论 -
27. Remove Element
Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.The order原创 2016-07-26 10:57:44 · 161 阅读 · 0 评论 -
203.Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5两个指针,等于哪个删哪个public class Solution { pub转载 2016-07-26 09:53:37 · 160 阅读 · 0 评论 -
Palindrome Numer
题目:Determine whether an integer is a palindrome. Do this without extra space. 不使用其它空间的意思是不是不调用其它函数??… Palindrome integer就是说正看倒看都是一样的整数。比如23432,121等。 题目给的提示有:负数是否可以成为回文?给出的答案是不能。这也就意味着0可以。在考虑number r原创 2016-07-08 23:34:01 · 211 阅读 · 0 评论