leetcode_110_ Balanced Binary Tree,balancedbinarytree歡迎大家閱讀參考,如有錯誤或疑問請留言糾正,謝謝 Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the
Light OJ 1341 Aladdin and the Flying Carpet,ojaladdinIt's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter to a
C. Watto and Mechanism(字典樹加dfs),wattodfsCF的傳送門題目的意思是給你n個字串和m個詢問,每次詢問一個字串是否可以通過改變其中的一個字母來得到n個字串中的任意一個,如果可以輸出"YES",否則輸出"NO";字典樹加DFS,首先對所給的字串建立一顆字典樹,然後對於每一個字串的查詢,進行dfs就行,具體看下代碼吧!在這裡介紹個講得不錯的字典樹部落格:
Codeforces Round #291 (Div. 2)---D. R2D2 and Droid Army, time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outputAn army of n droids is lined up in one row. Each droid is described by m
leetcode_143_Reorder List,sortlistleetcode歡迎大家閱讀參考,如有錯誤或疑問請留言糾正,謝謝Reorder List Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,
leetcode_25_Reverse Nodes in k-Group,leetcode歡迎大家閱讀參考,如有錯誤或疑問請留言糾正,謝謝Reverse Nodes in k-Group Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then