Tag Archives: BFS

Number of Distinct Islands
Leave a commentOctober 8, 2017 by oneOokay
问题在于如何存/translate an island so you can distinct them from each other. 我的代码跑过了所有700+个test case但是就是最后两个跑不过,而且test case太大不可能debug.最终拿了别人的pass的代码一个一个比较output才明白为什么我卡在最后两个test case了… 我的: main method里面 boolean[][] visited和String …
Continue reading 
Walls and Gates
Leave a commentSeptember 21, 2017 by oneOokay
You are given a m x n 2D grid initialized with these three possible values. 1 – A wall or an obstacle. 0 – …
Continue reading 
01 Matrix
Leave a commentJune 20, 2017 by oneOokay
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance …
Continue reading 
Topological Sorting Related
Leave a commentDecember 18, 2016 by oneOokay
拓扑排序以及相关题目： 拓扑排序 For each directed edge A > B in graph, A must before B in the order list. The …
Continue reading 
Binary Tree Right Side View
Leave a commentNovember 22, 2016 by oneOokay
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you …
Continue reading 
Word Ladder II
Leave a commentNovember 21, 2016 by oneOokay
Given two words (beginWord and endWord), and a dictionary’s word list, find all shortest transformation sequence(s) from beginWord to endWord, …
Continue reading 
Word Break
Leave a commentNovember 6, 2016 by oneOokay
Given a string s and a dictionary of words dict, determine if s can be segmented into a spaceseparated sequence …
Continue reading