摘要:题目: Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Example 2: Note: 0 < s1.length, s2
阅读全文
摘要:题目: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 思路: 这道题看起来并不难,但是有很多需要注意的点,我用了很久的时间才通过这道题。大致的思路
阅读全文
摘要:题目: 448. Find All Numbers Disappeared in an Array Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and ot
阅读全文
摘要:题目: 1. Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each inpu
阅读全文
摘要:题目: Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example:Given n = 2, return 91. (The answer should be
阅读全文
摘要:题目: Given a list of positive integers, the adjacent integers will perform the float division. For example, [2,3,4] -> 2 / 3 / 4. However, you can add
阅读全文
摘要:题目: Sort a linked list using insertion sort. 思路: 链表的插入排序和数组的插入排序略有不同。以链表4->2->3->1->5为例,为方便操作添加一个头节点-1,此时链表为-1->4->2->3->1->5。基本思路为一次选择前后两个节点,若后节点大于前节
阅读全文
摘要:题目: Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Yo
阅读全文
摘要:题目: Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may a
阅读全文
摘要:题目: 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 t
阅读全文
摘要:题目: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 ->
阅读全文
摘要:题目: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exi
阅读全文
摘要:题目: 141.Given a linked list, determine if it has a cycle in it. 142.Given a linked list, return the node where the cycle begins. If there is no cycle,
阅读全文
摘要:题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is l
阅读全文
摘要:题目: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums exc
阅读全文
摘要:题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would hav
阅读全文
摘要:题目: 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 i
阅读全文