自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

ScutKevinYzy的博客

这里记一些笔记

  • 博客(441)
  • 收藏
  • 关注

原创 Lintcode 738.Count Different Palindromic Subsequences go

/**738 · 计数回文子序列算法HardAccepted Rate34%DescriptionSolutionNotesDiscussLeaderboardDescription给出一个字符串 S, 计算字符串 S 中不同非空回文子序列的数量, 返回这个数对 10^9 + 7 取模后得结果.字符串 S 的子序列可以通过删去 S 中 0 个或多个字符得到. 一个序列如果是回文的, 那么它逆序后与原序列相等.两个序列 A[1], A[2], … B[1], B[2], … 如果存在 A[

2021-06-16 11:37:29 214

原创 Lintcode 727 · Chinese Remainder Theorem go

/**727 · Chinese Remainder TheoremAlgorithmsHardAccepted Rate32%DescriptionSolutionNotesDiscussLeaderboardDescriptionWe are given two arrays num[0…k-1] and rem[0…k-1]. In num[0…k-1], every pair is coprime (gcd for every pair is 1). We need to find

2021-06-16 10:55:33 211

原创 Lintcode 721 · 下一个稀疏数 go

/**721 · 下一个稀疏数算法HardAccepted Rate38%DescriptionSolutionNotesDiscussLeaderboardDescription一个数是稀疏数如果这个数的 二进制表示 中没有相邻的 1,给出一个 n ,找出大于或等于 n 的最小的稀疏数。eg. 5 (二进制表示为 101)是稀疏数,但是 6 (二进制表示为 110 )不是稀疏数Example样例 1:输入:6输出:8解释:6 = 110(2) 并且 8 = 1000(2)样

2021-06-16 10:30:17 243

原创 Lintcode 699 · Check Sum of K Primes go

/**699 · Check Sum of K PrimesAlgorithmsHardAccepted Rate27%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven two numbers n and k. We need to find out if n can be written as sum of k prime numbers.n <= 10 ^ 9ExampleExample 1Input:n

2021-06-16 09:41:46 105

原创 Lintcode 676 · Decode Ways II go

/**676 · Decode Ways IIAlgorithmsHardAccepted Rate39%DescriptionSolutionNotesDiscussLeaderboardDescriptionA message containing letters from A-Z is being encoded to numbers using the following mapping way:‘A’ -> 1‘B’ -> 2…‘Z’ -> 26Beyo

2021-06-04 17:21:13 77

原创 Lintcode 639 · Word Abbreviation go

/**639 · 单词缩写算法HardAccepted Rate44%DescriptionSolutionNotesDiscussLeaderboardDescription给出一组 n 个不同的非空字符串,您需要按以下规则为每个单词生成 最小 的缩写。从第一个字符开始,然后加上中间缩写掉的字符的长度,后跟最后一个字符。如果有冲突,就是多个单词共享相同的缩写,使用较长的前缀,而不是仅使用第一个字符,直到使单词的缩写的映射变为唯一。 换句话说,最终得到的缩写不能映射到多个原始单词。如果

2021-06-03 19:10:39 84

原创 Postgre sql常用的一些命令

SELECT select_expressions INTO [STRICT] target FROM ...;INSERT ... RETURNING expressions INTO [STRICT] target;UPDATE ... RETURNING expressions INTO [STRICT] target;DELETE ... RETURNING expressions INTO [STRICT] target;参考:https://www.yiibai.com/manual

2021-06-03 10:55:31 311

原创 Lintcode 633 · Find the Duplicate Number go

/**633 · Find the Duplicate NumberAlgorithmsHardAccepted Rate49%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), guarantee that at least one duplic

2021-06-02 15:12:42 65

原创 Lintcode600 · Smallest Rectangle Enclosing Black Pixels go

/**600 · Smallest Rectangle Enclosing Black PixelsAlgorithmsHardAccepted Rate38%DescriptionSolutionNotesDiscussLeaderboardDescriptionAn image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are con

2021-06-01 19:27:16 117

原创 Lintcode516 · Paint House II go

/**516 · Paint House IIAlgorithmsHardAccepted Rate36%DescriptionSolutionNotesDiscussLeaderboardDescriptionThere are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is diffe

2021-05-31 19:18:21 84

原创 Lintcode 450 · Reverse Nodes in k-Group go

/**450 · Reverse Nodes in k-GroupAlgorithmsHardAccepted Rate40%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a mu

2021-05-19 14:29:21 66

原创 Lintcode430 · Scramble String go

/**430 · Scramble StringAlgorithmsHardAccepted Rate42%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible rep

2021-05-12 11:31:38 103

原创 Lintcode183 · Wood Cut go

/**183 · Wood CutAlgorithmsHardAccepted Rate29%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven n pieces of wood with length L[i] (integer array). Cut them into small pieces to guarantee you could have equal or more than k pieces with the

2021-05-11 16:05:36 91

原创 Lintcode1046 · Prime Number of Set Bits in Binary Representation go

/**1046 · Prime Number of Set Bits in Binary RepresentationAlgorithmsEasyAccepted Rate70%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime numbe

2021-05-11 15:43:04 63

原创 Lintcode168 · Burst Balloons go

/**168 · Burst BalloonsAlgorithmsHardAccepted Rate51%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the

2021-05-10 19:13:11 79

原创 Lintcode154 · Regular Expression Matching go

/**154 · Regular Expression MatchingAlgorithmsHardAccepted Rate31%DescriptionSolutionNotesDiscussLeaderboardDescriptionImplement regular expression matching with support for ‘.’ and ‘*’.‘.’ Matches any single character.‘*’ Matches zero or more of

2021-05-08 15:06:47 75

原创 Lintcode1892 · Mine-sweeping go

/**1892 · Mine-sweepingAlgorithmsMediumAccepted Rate36%DescriptionSolutionNotesDiscussLeaderboardDescriptionIt’s an easy mine-sweeping game.You are given a n*m matrix as the map of game.Each position has a value (0 or 1, 1 means there is no thunde

2021-05-07 14:54:28 113

原创 Lintcode 1891 · Travel Plan go

/**1891 · Travel PlanAlgorithmsMediumAccepted Rate60%DescriptionSolutionNotesDiscussLeaderboardDescriptionThere are n cities, and the adjacency matrix arr represents the distance between any two cities.arr[i][j] represents the distance from city i

2021-05-06 19:38:19 104

原创 Lintcode1890 · Form Minimum Number go

/**1890 · Form Minimum NumberAlgorithmsMediumAccepted Rate61%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven a pattern str containing only I and D. I for increasing and D for decreasing. Please design an algorithm to return the string th

2021-04-30 15:01:51 113 1

原创 Lintcode1888 · Shortest Path in Matrix go

/**1888 · Shortest Path in MatrixAlgorithmsMediumAccepted Rate44%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven the matrix of M rows and N columns, 0 represents empty space, - 1 represents obstacle, and 1 represents target points (there

2021-04-30 14:29:40 99

原创 Lintcode1851 · Buy Passes go

/**1851 · Buy PassesAlgorithmsMediumAccepted Rate52%DescriptionSolutionNotesDiscussLeaderboardDescriptionAlex plans on visiting the museum and is at the counter to purchase passes for the same. The administrators have decided not to sell group pass

2021-04-29 15:17:12 161

原创 Lintcode1833 · pen box go

/**1833 · pen boxAlgorithmsMediumAccepted Rate50%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven you an array boxes and a target. Boxes[i] means that there are boxes[i] pens in the ith box. Subarray [i, j] is valid if sum(boxes[i] + boxe

2021-04-29 15:04:36 203

原创 Lintcode1753 · Doing Homework go

/**1753 · Doing HomeworkAlgorithmsMediumAccepted Rate38%DescriptionSolutionNotesDiscussLeaderboardDescriptionFor n people, each of them needs to do m jobs independently.The i job takes cost[i] time. Since each person’s free time is different, the

2021-04-29 14:40:45 78

原创 Lintcode1736 · Throw garbage go

/**1736 · Throw garbageAlgorithmsMediumAccepted Rate51%DescriptionSolutionNotesDiscussLeaderboardDescriptionThere are n garbage bags, and the weight of each garbage bag is between [1.01, 3.00] pounds.You can take up to 3.00 pounds of garbage one t

2021-04-28 10:47:05 125

原创 Lintcode1511 · Mirror Reflection go

/**1511 · Mirror ReflectionAlgorithmsMediumAccepted Rate74%DescriptionSolutionNotesDiscussLeaderboardDescriptionThere is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptors on each of t

2021-04-27 16:02:03 90

原创 Lintcode1508 · Score After Flipping Matrix go

/**1508 · Score After Flipping MatrixAlgorithmsMediumAccepted Rate89%DescriptionSolutionNotesDiscussLeaderboardDescriptionWe have a two dimensional matrix A where each value is 0 or 1.A move consists of choosing any row or column, and toggling eac

2021-04-27 15:57:13 83

原创 Lintcode1499 · Reordered Power of 2 go

/**1499 · Reordered Power of 2AlgorithmsMediumAccepted Rate62%DescriptionSolutionNotesDiscussLeaderboardDescriptionStarting with a positive integer N, we reorder the digits in any order (including the original order) such that the leading digit is

2021-04-27 15:26:57 68

原创 Lintcode1492 · Koko Eating Bananas go

/**1492 · Koko Eating BananasAlgorithmsMediumAccepted Rate59%DescriptionSolutionNotesDiscussLeaderboardDescriptionKoko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards have gone and will come back i

2021-04-27 15:02:22 65

原创 Lintcode1477 · Car Fleet go

/**1477 · Car FleetAlgorithmsMediumAccepted Rate53%DescriptionSolutionNotesDiscussLeaderboardDescriptionN cars are going to the same destination along a one lane road. The destination is target miles away.Each car i has a constant speed speed[i] (

2021-04-27 14:44:39 83

原创 Lintcode1457 · Search Subarray go

/**1457 · Search SubarrayAlgorithmsMediumAccepted Rate40%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven an array arr and a nonnegative integer k, you need to find a continuous array from this array so that the sum of this array is k. Ou

2021-04-27 11:36:57 80

原创 Lintcode1448 · Card Game go

/**1448 · Card GameAlgorithmsMediumAccepted Rate34%DescriptionSolutionNotesDiscussLeaderboardDescriptionA card game that gives you the number of cards n,and two non-negative integers: totalProfit, totalCost. Then it will give you the profit value o

2021-04-27 11:19:49 96

原创 Lintcode1439 · Consecutive Numbers Sum go

/**1439 · Consecutive Numbers SumAlgorithmsMediumAccepted Rate50%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven a positive integer N, how many groups of continuous positive integers satisfy that the sum of all numbers is N?1 <= N &l

2021-04-27 10:17:12 94

原创 Lintcode1435 · Find And Replace in String go

/**1435 · Find And Replace in StringAlgorithmsMediumAccepted Rate63%DescriptionSolutionNotesDiscussLeaderboardDescriptionTo some string S, we will perform some replacement operations that replace groups of letters with new ones (not necessarily the

2021-04-27 09:23:22 87

原创 Lintcode1433 · Image Overlap go

/**1433 · Image OverlapAlgorithmsMediumAccepted Rate65%DescriptionSolutionNotesDiscussLeaderboardDescriptionTwo images A and B are given, represented as binary, square matrices of the same size. (A binary matrix has only 0s and 1s as values.)We tr

2021-04-26 19:56:05 75

原创 Lintcode1431 · Push Dominoes go

/**1431 · Push DominoesAlgorithmsMediumAccepted Rate60%DescriptionSolutionNotesDiscussLeaderboardDescriptionThere are N dominoes in a line, and we place each domino vertically upright.In the beginning, we simultaneously push some of the dominoes e

2021-04-26 19:44:13 69

原创 Lintcode1602 · Decoded String at Index go

/**1602 · Decoded String at IndexAlgorithmsMediumAccepted Rate56%DescriptionSolutionNotesDiscussLeaderboardDescriptionAn encoded string S is given. To find and write the decoded string to a tape, the encoded string is read one character at a time a

2021-04-23 14:36:45 83

原创 Lintcode1601 · Boats to Save People go

/**1601 · Boats to Save PeopleAlgorithmsMediumAccepted Rate61%DescriptionSolutionNotesDiscussLeaderboardDescriptionThe i-th person has weight people[i], and each boat can carry a maximum weight of limit.Each boat carries at most 2 people at the sa

2021-04-22 19:45:38 81

原创 Lintcode1375 · Substring With At Least K Distinct Characters go

/**1375 · Substring With At Least K Distinct CharactersAlgorithmsMediumAccepted Rate45%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven a string S with only lowercase characters.Return the number of substrings that contains at least k di

2021-04-21 17:29:32 78

原创 LintCode1371 · Linked List Components go

/**1371 · Linked List ComponentsAlgorithmsMediumAccepted Rate66%DescriptionSolutionNotesDiscussLeaderboardDescriptionWe are given head, the head node of a linked list containing unique integer values.We are also given the list G, a subset of the v

2021-04-21 16:54:43 63

原创 Lintcode1357.Path Sum II go

/**1357 · Path Sum IIAlgorithmsMediumAccepted Rate78%DescriptionSolutionNotesDiscussLeaderboardDescriptionGiven a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.A leaf is a node with no children.Exam

2021-04-21 15:54:06 77

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除