随笔分类 -  算法

本分类用于存放一些算法题,主要来源于Leetcode。
摘要:题目 Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the re 阅读全文
posted @ 2022-06-21 17:04 frankming 阅读(27) 评论(0) 推荐(0) 编辑
摘要:题目 Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties: Integers 阅读全文
posted @ 2022-06-14 19:54 frankming 阅读(18) 评论(0) 推荐(0) 编辑
摘要:题目 Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order. Example 1: Input: n = 3 Output: [[1,2,3],[8 阅读全文
posted @ 2022-06-14 19:47 frankming 阅读(24) 评论(0) 推荐(0) 编辑
摘要:题目 You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which me 阅读全文
posted @ 2022-06-13 20:32 frankming 阅读(20) 评论(0) 推荐(0) 编辑
摘要:题目 Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal's triangle. In Pascal's triangle, each number is the sum of the two 阅读全文
posted @ 2022-06-10 16:25 frankming 阅读(26) 评论(0) 推荐(0) 编辑
摘要:题目 Design a HashMap without using any built-in hash table libraries. Implement the MyHashMap class: MyHashMap() initializes the object with an empty m 阅读全文
posted @ 2022-06-10 16:07 frankming 阅读(36) 评论(0) 推荐(0) 编辑
摘要:题目 Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping interv 阅读全文
posted @ 2022-06-06 17:15 frankming 阅读(17) 评论(0) 推荐(0) 编辑
摘要:题目 Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors 阅读全文
posted @ 2022-06-02 15:59 frankming 阅读(22) 评论(0) 推荐(0) 编辑
摘要:题目 Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assum 阅读全文
posted @ 2022-06-01 22:02 frankming 阅读(22) 评论(0) 推荐(0) 编辑
摘要:题目 Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each 阅读全文
posted @ 2022-05-17 19:52 frankming 阅读(24) 评论(0) 推荐(0) 编辑
摘要:题目 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. A subarray 阅读全文
posted @ 2022-05-16 00:09 frankming 阅读(14) 评论(0) 推荐(0) 编辑
摘要:题目 Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Example 1 阅读全文
posted @ 2022-05-15 23:52 frankming 阅读(20) 评论(0) 推荐(0) 编辑
摘要:题目 Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive int 阅读全文
posted @ 2022-04-18 11:40 frankming 阅读(23) 评论(0) 推荐(0) 编辑
摘要:题目 Given an integer array nums, design an algorithm to randomly shuffle the array. All permutations of the array should be equally likely as a result 阅读全文
posted @ 2022-04-14 20:38 frankming 阅读(22) 评论(0) 推荐(0) 编辑
摘要:题目 Given two integers left and right that represent the range [left, right], return the bitwise AND of all numbers in this range, inclusive. Example 1 阅读全文
posted @ 2022-04-13 20:25 frankming 阅读(25) 评论(0) 推荐(0) 编辑
摘要:题目 Given an integer n, break it into the sum of k positive integers, where k >= 2, and maximize the product of those integers. Return the maximum prod 阅读全文
posted @ 2022-04-13 19:28 frankming 阅读(23) 评论(0) 推荐(0) 编辑
摘要:题目 You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Retu 阅读全文
posted @ 2022-04-12 17:33 frankming 阅读(23) 评论(0) 推荐(0) 编辑
摘要:题目 Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operati 阅读全文
posted @ 2022-04-08 15:46 frankming 阅读(21) 评论(0) 推荐(0) 编辑
摘要:题目 Given two strings word1 and word2, return the minimum number of steps required to make word1 and word2 the same. In one step, you can delete exactl 阅读全文
posted @ 2022-04-08 15:08 frankming 阅读(25) 评论(0) 推荐(0) 编辑
摘要:题目 Given an integer array nums, return the number of longest increasing subsequences. Notice that the sequence has to be strictly increasing. Example 阅读全文
posted @ 2022-04-07 13:36 frankming 阅读(26) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示