原创 【區間 dp】A006_LC_帶限制的子序列和(dp / 單調隊列優化)

一、Problem Given an integer array nums and an integer k, return the maximum sum of a non-empty subsequence of that a

原创 【字符串】C037_LC_重新格式化字符串(思維題)

一、Problem Given alphanumeric string s. (Alphanumeric string is a string consisting of lowercase English letters and

原创 【TSP】C000_NK_字節筆試題_畢業旅行問題(二進制枚舉)

一、Problem 小明目前在做一份畢業旅行的規劃。打算從北京出發,分別去若干個城市,然後再回到北京,每個城市之間均乘坐高鐵,且每個城市只去一次。由於經費有限,希望能夠通過合理的路線安排儘可能的省一些路上的花銷。給定一組城市和每對

原创 【搜索】B055_LQ_梅花樁(bfs / 貪心)

一、Problem 小明每天都要練功,練功中的重要一項是梅花樁。 小明練功的梅花樁排列成 n 行 m 列,相鄰兩行的距離爲 1,相鄰兩列的距離也爲 1。 小明站在第 1 行第 1 列上,他要走到第 n 行第 m 列上。小明已經練了

原创 【數組】B066_NK_機器人跳躍問題(二分 / 遞推)

一、Problem 機器人正在玩一個古老的基於DOS的遊戲。遊戲中有N+1座建築——從0到N編號,從左到右排列。 編號爲0的建築高度爲0個單位,編號爲 i 的建築高度爲H(i)個單位。起初,機器人在編號爲0的建築處。每一步,它跳到

原创 【數組】B067_LC_和爲K的子數組(暴力 / 前綴和 + map)

一、Problem Given an array of integers and an integer k, you need to find the total number of continuous subarrays wh

原创 【01 dp】A005_LC_生成數組(暴搜 / 記憶化 / dp)

一、Problem Given three integers n, m and k. Consider the following algorithm to find the maximum element of an array

原创 【數組】B065_LC_統計作戰單位數(暴力 / 思維題 / dp)

一、Problem There are n soldiers standing in a line. Each soldier is assigned a unique rating value. You have to form

原创 【博弈】A000_LC_石子游戲 III(記憶化搜索 + dp / 純 dp)

一、Problem Alice and Bob continue their games with piles of stones. There are several stones arranged in a row, and

原创 零基礎學唱歌到底需要學習哪些內容?

一、初級階段 這個階段主要學習的是一些基礎音樂理論知識、節奏和音準。這三個方面是尤其重要的。就像一棟房子的地基,那我們應該都能明白,如果你地基不穩,那麼後面也不會學的太好,知識都是一環扣一環的。 1. 基本樂理知識 樂理知識會影響

原创 【數組】C063_LC_有多少小於當前數字的數字(思維題 = 排序 + mp / 桶排序)

一、Problem Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That i

原创 【數組】B064_LC_燈泡開關 III(思維題)

一、Problem There is a room with n bulbs, numbered from 1 to n, arranged in a row from left to right. Initially, all

原创 【數組】B062_LC_通過投票對團隊排名(排序技巧)

一、Problem In a special ranking system, each voter gives a rank from highest to lowest to all teams participated in

原创 【圖論】B033_LC_通知所有員工所需的時間(自底向上 / 自頂向下)

一、Problem A company has n employees with a unique ID for each employee from 0 to n - 1. The head of the company has

原创 【圖論】A031_LC_使網格圖至少有一條有效路徑的最小代價(最短路變形)

一、Problem Given a m x n grid. Each cell of the grid has a sign pointing to the next cell you should visit if you ar