1. 题目 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 39…
分类:LeetCode题目解答
【Leetcode】14. Longest Common Prefix 两个字符串的最长公共前缀长度
1. 题目 Write a function to find the longest common prefix string amongst an array of strings. 2. 思路 遍历按序逐个比较,直接…
【Leetcode】15. 3Sum 集合中选三个元素之和等于0
1. 题目 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique…
【Leetcode】16. 3Sum Closest 集合中选三个元素之和最接近指定值
1. 题目 Given an array S of n integers, find three integers in S such that the sum is closest to a given number,…
【Leetcode】17. Letter Combinations of a Phone Number 九键的数字串转字母串
1. 题目 Given a digit string, return all possible letter combinations that the number could represent. A mapping…
【Leetcode】18. 4Sum 给定数组中的4个元素之和等于给定值的所有组合
1. 题目 Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target?…
【leetcode】19. Remove Nth Node From End of List 删除链表的倒数第N个元素
1. 题目 Given a linked list, remove the nth node from the end of list and return its head. For example, Given li…
【leetcode】20. Valid Parentheses 括号串的合法判断
1. 题目 Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘…
【leetcode】21. Merge Two Sorted Lists 两个有序链表的归并有序
1. 题目 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing toget…
【leetcode】22. Generate Parentheses 合法括号串的所有组合
1. 题目 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. …
【leetcode】23. Merge k Sorted Lists 多个有序链表的合并有序
1. 题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 2. 思路…
【leetcode】24. Swap Nodes in Pairs 链表奇偶节点交换
1. 题目 Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3-…