Happy Coding

This blog is for my memorandum about programming and English.

Happy Coding

This blog is for my memorandum

再帰

Paths with Sum

problem You are given a binary tree in which each node contains an integer value(which might be positive or negative). Design an algorithm to count the number of paths that sum to a given value. The path does not need to start or end at th…

Validate BST

problem Implement a function to check if a binary tree is a binary search tree. how to solve Binary search tree means that all left nodes must be less than or equal to the current node and all right nodes must be more than or equal to the …

mini-maxとメモ化探索によるゲーム木探索 AtCoder Beginner Contest 025 C - 双子と○×ゲーム

問題 abc025.contest.atcoder.jp note マップの情報をメモ化するのに手こずった。 vectorなどであればmapのキーにできるが、自作の構造体などであると、そのままではハッシュテーブルのキーに出来ない。 詳しくは下を参考 stackoverflow.com qiita.com あと…

AtCoder Beginner Contest 026 C - 高橋君の給料

C - 高橋君の給料 時間制限 : 2sec / メモリ制限 : 256MB 問題文 高橋君は、社員が N 人いる会社の社長です。高橋君の会社では、以下のように給料が決まっています。 高橋君を含む社員の全員が、 1 から N までの社員番号を持っている。高橋君の社員番号はも…

merge sort

マージソートの実装 分割統治法と再帰の練習