LeetCode Weekly Contest 122
LeetCode Weekly Contest 122:
https://leetcode.com/contest/weekly-contest-122/
-
masashinakata
- 486
- 1
- 0
- 0
![](https://s.togetter.com/static/web/img/placeholder.gif)
二問目、葉のリストを作っておいて、そこからrootへ戻る……って方針で解こうとしたんだけど、binary treeのクラスだと戻る操作が書きにくい(EDGEのLISTを作ったりすればできるけど)ことに気付いて断念。 再帰で書く方針に切り替えるのに時間がかかった。
2019-02-03 13:02:22![](https://s.togetter.com/static/web/img/placeholder.gif)
LeetCode全完したけど519位。 A. 偶数と奇数の合計を保持 B. 葉からぜんぶやる C. BをイテレートしてAでLowerBound() D. ノードをDFSしてXY位置を覚えて並び替え C40分もかかった。
2019-02-03 13:02:42![](https://s.togetter.com/static/web/img/placeholder.gif)
今回のleetcode簡単だった....けど時間が足りなくて最後の一問は解けなかった.....スピードあげなくちゃ
2019-02-03 13:03:03![](https://s.togetter.com/static/web/img/placeholder.gif)
LeetCode Weekly Contest 122 急激に難易度が下がった感。こういう時もあるのだろう(*´~`) A - N が最大 10^4 であった。O(N^2) なコードで通るかな?と思って出してみたら通った B - DFS できれば解ける C - UnionFind の典型問題っぽい? 復習の対象 D - 手付かず
2019-02-03 13:03:29![](https://s.togetter.com/static/web/img/placeholder.gif)
LeetCode122 A:予め全偶数の和を計算しておいてクエリ毎に対象の偶奇をチェック B:根から順に文字列を作っていって葉に到達したらできた文字列を逆順にする C:値を2倍してmap<int, int>を使ったimos D:map<int, vector<pair<int, int>>> (map<x, vector<y, val>>)
2019-02-03 13:43:53![](https://s.togetter.com/static/web/img/placeholder.gif)
LeetCode Weekly Contest 122 - Togetter: togetter.com/li/1315502
2019-02-03 14:54:48