leetcode刷题记--RomamToInteger.md

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. 1 2 3 4 5 6 7 8 Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, two is written as II in Roman numeral, just two one’s added together. Twelve is written as, XII, which is simply X + II. The number twenty seven

leetcode--ThreeSum.md

Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not contain duplicate triplets. Example: Given array nums = [-1, 0, 1, 2, -1, -4], A solution set is: [ [-1, 0, 1], [-1, -1, 2] ] 1

leetcode刷题记--LongestCommonPrefix-续

解法剖析 来自leetcode 具体的内容我就不复制粘贴了,只讲一下我对每种解法的理解 Horizontal scanning 1 2 3 4 5 6 7 8 9 10 public String longestCommonPrefix(String[] strs) { if (strs.length == 0) return ""; String prefix = strs[0]; for (int

leetcode刷题记--LongestCommonPrefix

Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “". Example 1: 1 2 Input: ["flower","flow","flight"] Output: "fl" Example 2: 1 2 3 Input: ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input strings. Note: All given inputs are in lowercase letters a-z. My Answer: 1 2 3 4 5 6