
leetcode
李说
这个作者很懒,什么都没留下…
展开
-
35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. Ex...原创 2019-01-10 17:08:41 · 140 阅读 · 0 评论 -
34 Find First and Last Position of Element in Sorted Array
class Solution { public int[] searchRange(int[] nums, int target) { int[] res = new int[]{-1, -1}; if (nums == null || nums.length == 0) { return res; } ...原创 2019-01-10 23:12:11 · 99 阅读 · 0 评论 -
33 Search in Rotated Sorted Array
class Solution { public int search(int[] nums, int target) { if (nums == null || nums.length == 0) { return -1; } int left = 0; int right = nums.length ...原创 2019-01-10 23:24:45 · 102 阅读 · 0 评论 -
19. Remove Nth Node From End of List
Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the l...原创 2019-01-24 10:56:53 · 115 阅读 · 0 评论 -
21. 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. Example: Input: 1->2->4, 1->3->4 Output: 1->...原创 2019-01-24 11:07:03 · 115 阅读 · 0 评论