代码改变世界

[LeetCode] 103. Binary Tree Zigzag Level Order Traversal _ Medium tag: BFS

2018-07-05 06:27 by Johnson_强生仔仔, 123 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 阅读全文

[LeetCode] 207 Course Schedule_Medium tag: BFS, DFS

2018-07-05 06:08 by Johnson_强生仔仔, 263 阅读, 0 推荐, 收藏, 编辑
摘要:There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to 阅读全文

[LeetCode] 133. Clone Graph_ Medium tag: BFS, DFS

2018-07-05 05:06 by Johnson_强生仔仔, 155 阅读, 0 推荐, 收藏, 编辑
摘要:Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled 阅读全文

[LeetCode] 675. Cut Off Trees for Golf Event_Hard tag: BFS

2018-07-04 23:13 by Johnson_强生仔仔, 512 阅读, 1 推荐, 收藏, 编辑
摘要:You are asked to cut off trees in a forest for a golf event. The forest is represented as a non-negative 2D map, in this map: 0 represents the obstacl 阅读全文

[LeetCode] 127. Word Ladder _Medium tag: BFS

2018-07-04 10:16 by Johnson_强生仔仔, 250 阅读, 0 推荐, 收藏, 编辑
摘要:Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, 阅读全文

[LeetCode] 102. Binary Tree Level Order Traversal_Medium tag: BFS

2018-07-04 08:20 by Johnson_强生仔仔, 231 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree [3 阅读全文

[LeetCode] 200. Number of Islands_ Medium tag: BFS

2018-07-04 04:40 by Johnson_强生仔仔, 368 阅读, 0 推荐, 收藏, 编辑
摘要:Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen 阅读全文

[LeetCode] 199. Binary Tree Right Side View_ Medium tag: BFS, Amazon

2018-07-04 04:04 by Johnson_强生仔仔, 192 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example 阅读全文

[Leetcode] 863. All Nodes Distance K in Binary Tree_ Medium tag: BFS, Amazon

2018-07-03 09:35 by Johnson_强生仔仔, 771 阅读, 0 推荐, 收藏, 编辑
摘要:We are given a binary tree (with root node root), a target node, and an integer value `K`. Return a list of the values of all nodes that have a distan 阅读全文

[LeetCode] 529. Minesweeper_ Medium_ tag: BFS

2018-07-03 06:04 by Johnson_强生仔仔, 290 阅读, 0 推荐, 收藏, 编辑
摘要:Let's play the minesweeper game (Wikipedia, online game)! You are given a 2D char matrix representing the game board. 'M' represents an unrevealed min 阅读全文