tiktok停止服务,看看tiktok以往的面试题
来提每日一题
2025-01-20 15:04:15
近期找工作现状 北美求职 每天59秒拿下每日一题 转码 tiktok
国区每日一题今日思路(.cn):
动态规划。记dp[i]为遍历至i位置不同种打字方案,每个位置至多从前3个状态转移,并且必须前j个字符与i字符相同。
DP. Given dp[i] represent the number of distinct typing methods up to position i. Each position can transition from at most the previous three states, and the first j characters must match the i-th character.
国际站每日一题今日思路(.com):
优先队列。因为每个位置可以接雨水的数量取决于其周围的最大高度。使用小根堆维护高度和坐标,每次选择最小出队,遍历相邻四个方向;若未访问将其加入队列;若相邻高度矮于当前,则可以接水的数量等于高度差。
Priority queue. The amount of water that can be trapped at each position depends on the minimum of the maximum heights of its surrounding cells. Use a min-heap to maintain the heights and coordinates. Each time, dequeue the smallest element and traverse its four neighboring directions. If a neighbor has not been visited, add it to the queue. If the neighbor's height is lower than the current height, the amount of water trapped equals the height difference.
看到这都是真爱了,点个关注和赞吧![喝奶茶R]
If you found this helpful, give me a like and follow!
0
阅读:7