instant 2D版frog jump,規(guī)定跳躍方向是右或下方窍蓝。 基本的思路就是依次動態(tài)規(guī)劃,沒有什么不同伊磺。只是需要兩個map來對每個石頭進行行和列的索引。 下面的代碼我也...
給一個binary tree蜀备,每一個node含有parent指向parent,給定一個node荒叶,找出他右側的node琼掠。 instant 用了dfs,順著左停撞,右瓷蛙,父的順序找,標...
two node sum to a target on a binary search tree. instant I think there should be a bet...
instant 主要思路仍然是bfs戈毒,利用數據結構存儲當前飛行高度艰猬。比較重要的一點是正確剪枝,可以通過比較當前距離d + 當前飛行高度h 與 **目前得到結果 ** 的大小來...
原題 解法這位同學說的很清楚了埋市。 第一個array只有total count是有用信息冠桃,數一遍就好了。第二個array那里可以預處理一下把count先數好道宅,把有字母occur...
leetcode two heap use two heap is quite straight forward. use binary tree Use the binar...
snap (1)find median from data stream** only use one tree ** instant solution (2)compose...
leetcode 這道題做起來的時候比較困難食听,有些地方不太容易想清楚。 首先應用DP的思路DP[i][j] 表示 在前j天進行最多i次交易時的最大profits這是容易考慮到...
Download the subtitles:射手 Convert the subtitles:subflicks Press Ctrl + Alt + Shift + T ...
leetcode For this kind of problem, it is easy to get the idea that we can cut the whole...
leetcode this is an easy problem.** first recursion ** dp[i] = max(dp[i - 1], dp[i - 2]...