作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 正则+字典 日期 题目地址:https://leetcode.com/problems/camelcase-matching/ 题目描述 A query word matches a given pattern if we can insert lowercase letters to the pattern word so that it equa…
Roman to IntegerGiven a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. SOLUTION 1: 思路: 从后往前遍历罗马数字,如果某个数比前一个数小,则把该数在结果中减掉:反之,则在结果中加上当前这个数: GITHUB 代码: https://github.com/yuzhangcmu/LeetCode_algorithm…
暴力查找 class Solution: def camelMatch(self, queries: List[str], pattern: str) -> List[bool]: q_size=len(queries) p_size=len(pattern) ans=[True for i in range(q_size)] for i,query in enumerate(queries): idx=[query.find(pattern[0])] if idx[-1]==-1: ans[i…
最近做leetcode总感觉自己是个智障,基本很少有题能自己独立做出来,都是百度... 不过终于还是做出了一题...而且速度效率还可以 哎,加油吧,尽量锤炼自己 package y2019.Algorithm.str.medium; import java.util.ArrayList; import java.util.List; /** * @Auther: xiaof * @Date: 2019/11/21 09:00 * @Description: 1023. Camelcase Mat…
[LeetCode]120. Triangle 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址https://leetcode.com/problems/triangle/description/ 题目描述: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjac…
LeetCode 1 Two Sum 解题报告 偶然间听见leetcode这个平台,这里面题量也不是很多200多题,打算平时有空在研究生期间就刷完,跟跟多的练习算法的人进行交流思想,一定的ACM算法积累可以对以后在对算法中优化带来好处.Ok,今天是我做的第一题Add Two Sum. 题目要求 Given an array of integers, find two numbers such that they add up to a specific target number. The fu…
[题目] Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [1,1,2], [1,2,1], and [2,1,1]. [解析] 题意:求一个数组的全排列.与[LeetCode]Permutations 解题报告 不同的是…
[LeetCode]Island Perimeter 解题报告 [LeetCode] https://leetcode.com/problems/island-perimeter/ Total Accepted: 16143 Total Submissions: 28552 Difficulty: Easy Question You are given a map in form of a two-dimensional integer grid where 1 represents land…
[LeetCode]01 Matrix 解题报告 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/01-matrix/#/description 题目描述: Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example:…
[LeetCode]Largest Number 解题报告 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/largest-number/#/description 题目描述: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], t…