2.09 Tìm kiếm theo chiều sâu (Depth First Search)

STTTiêu đềLời giảiĐộ khóĐộ phức tạp thời gianĐộ phức tạp bộ nhớYêu thíchTỷ lệ AC (Acceptance)
0094Duyệt trung thứ tự cây nhị phân (Binary Tree Inorder Traversal)GoEasy73.8%
0098Cây nhị phân tìm kiếm hợp lệ (Validate Binary Search Tree)GoMediumO(n)O(1)32.0%
0099Khôi phục cây nhị phân tìm kiếm (Recover Binary Search Tree)GoMediumO(n)O(1)51.0%
0100Cùng cây (Same Tree)GoEasyO(n)O(1)58.2%
0101Cây đối xứng (Symmetric Tree)GoEasyO(n)O(1)54.3%
0104Độ sâu tối đa của cây nhị phân (Maximum Depth of Binary Tree)GoEasyO(n)O(1)73.9%
0110Cây nhị phân cân bằng (Balanced Binary Tree)GoEasyO(n)O(1)49.1%
0111Độ sâu tối thiểu của cây nhị phân (Minimum Depth of Binary Tree)GoEasyO(n)O(1)44.5%
0112Tổng đường đi (Path Sum)GoEasyO(n)O(1)48.3%
0113Tổng đường đi II (Path Sum II)GoMediumO(n)O(1)57.1%
0114Làm phẳng cây nhị phân thành danh sách liên kết (Flatten Binary Tree to Linked List)GoMediumO(n)O(1)61.8%
0116Gán con trỏ next sang phải cho mỗi nút (Populating Next Right Pointers in Each Node)GoMedium60.4%
0124Tổng đường đi lớn nhất của cây nhị phân (Binary Tree Maximum Path Sum)GoHardO(n)O(1)39.2%
0129Tổng các số từ gốc đến lá (Sum Root to Leaf Numbers)GoMediumO(n)O(1)61.0%
0130Vùng bị bao quanh (Surrounded Regions)GoMedium36.8%
0144Duyệt tiền thứ tự cây nhị phân (Binary Tree Preorder Traversal)GoEasy66.9%
0145Duyệt hậu thứ tự cây nhị phân (Binary Tree Postorder Traversal)GoEasy68.0%
0199Nhìn từ bên phải của cây nhị phân (Binary Tree Right Side View)GoMediumO(n)O(1)61.6%
0200Số lượng hòn đảo (Number of Islands)GoMediumO(n^2)O(n^2)57.0%
0207Lịch trình khóa học (Course Schedule)GoMediumO(n^2)O(n^2)45.4%
0210Lịch trình khóa học II (Course Schedule II)GoMediumO(n^2)O(n^2)48.5%
0211Thiết kế cấu trúc dữ liệu thêm và tìm từ (Design Add and Search Words Data Structure)GoMedium44.0%
0222Đếm số nút của cây hoàn chỉnh (Count Complete Tree Nodes)GoMedium60.6%
0226Đảo cây nhị phân (Invert Binary Tree)GoEasy74.7%
0230Phần tử nhỏ thứ K trong BST (Kth Smallest Element in a BST)GoMedium70.2%
0235Tổ tiên chung thấp nhất của BST (Lowest Common Ancestor of a Binary Search Tree)GoMedium61.6%
0236Tổ tiên chung thấp nhất của cây nhị phân (Lowest Common Ancestor of a Binary Tree)GoMedium58.8%
0257Các đường đi của cây nhị phân (Binary Tree Paths)GoEasyO(n)O(1)61.4%
0297Tuần tự hóa và giải tuần tự cây nhị phân (Serialize and Deserialize Binary Tree)GoHard55.4%
0329Đường đi tăng dần dài nhất trong ma trận (Longest Increasing Path in a Matrix)GoHard52.4%
0337Kẻ trộm nhà III (House Robber III)GoMedium53.9%
0341Trình lặp danh sách lồng nhau (Flatten Nested List Iterator)GoMedium61.8%
0385Trình phân tích cú pháp mini (Mini Parser)GoMedium36.9%
0386Các số theo thứ tự từ điển (Lexicographical Numbers)GoMedium61.6%
0399Tính giá trị phép chia (Evaluate Division)GoMedium59.7%
0404Tổng lá trái (Sum of Left Leaves)GoEasy56.7%
0417Dòng chảy Thái Bình Dương - Đại Tây Dương (Pacific Atlantic Water Flow)GoMedium54.4%
0419Chiến hạm trên bảng (Battleships in a Board)GoMedium74.8%
0437Tổng đường đi III (Path Sum III)GoMedium48.0%
0463Chu vi đảo (Island Perimeter)GoEasy69.7%
0508Tổng cây con xuất hiện nhiều nhất (Most Frequent Subtree Sum)GoMedium64.9%
0513Tìm giá trị cây dưới cùng bên trái (Find Bottom Left Tree Value)GoMedium66.9%
0515Tìm giá trị lớn nhất của mỗi hàng (Find Largest Value in Each Tree Row)GoMediumO(n)O(n)64.6%
0529Dò mìn (Minesweeper)GoMedium65.7%
0530Hiệu tuyệt đối nhỏ nhất trong BST (Minimum Absolute Difference in BST)GoEasy57.3%
0538Chuyển BST thành cây lớn hơn (Convert BST to Greater Tree)GoMedium67.8%
0543Đường kính cây nhị phân (Diameter of Binary Tree)GoEasy56.8%
0547Số lượng tỉnh thành (Number of Provinces)GoMedium63.8%
0559Độ sâu tối đa của cây N nhánh (Maximum Depth of N-ary Tree)GoEasy71.7%
0563Độ nghiêng cây nhị phân (Binary Tree Tilt)GoEasy60.1%
0572Cây con của cây khác (Subtree of Another Tree)GoEasy46.4%
0589Duyệt tiền thứ tự cây N nhánh (N-ary Tree Preorder Traversal)GoEasy75.8%
0617Gộp hai cây nhị phân (Merge Two Binary Trees)GoEasy78.7%
0623Thêm một hàng vào cây (Add One Row to Tree)GoMedium59.5%
0637Trung bình các tầng của cây nhị phân (Average of Levels in Binary Tree)GoEasy71.7%
0653Hai tổng IV - Đầu vào là BST (Two Sum IV - Input is a BST)GoEasy61.0%
0662Độ rộng tối đa của cây nhị phân (Maximum Width of Binary Tree)GoMedium40.7%
0669Cắt tỉa cây nhị phân tìm kiếm (Trim a Binary Search Tree)GoMedium66.4%
0684Kết nối dư thừa (Redundant Connection)GoMedium62.2%
0685Kết nối dư thừa II (Redundant Connection II)GoHard34.1%
0690Tầm quan trọng của nhân viên (Employee Importance)GoMedium65.6%
0695Diện tích đảo lớn nhất (Max Area of Island)GoMedium71.8%
0721Gộp tài khoản (Accounts Merge)GoMedium56.3%
0733Tô màu loang (Flood Fill)GoEasy62.0%
0753Bẻ khóa két sắt (Cracking the Safe)GoHard55.8%
0756Ma trận chuyển tiếp kim tự tháp (Pyramid Transition Matrix)GoMedium52.7%
0765Các cặp đôi nắm tay (Couples Holding Hands)GoHard56.6%
0778Bơi trong nước dâng (Swim in Rising Water)GoHard59.8%
0783Khoảng cách tối thiểu giữa các nút BST (Minimum Distance Between BST Nodes)GoEasy59.3%
0785Đồ thị có phải lưỡng phân không? (Is Graph Bipartite?)GoMedium53.1%
0802Tìm các trạng thái an toàn cuối cùng (Find Eventual Safe States)GoMedium56.6%
0834Tổng khoảng cách trong cây (Sum of Distances in Tree)GoHard59.1%
0839Nhóm chuỗi tương tự (Similar String Groups)GoHard48.0%
0841Chìa khóa và căn phòng (Keys and Rooms)GoMedium71.5%
0851Ồn ào và giàu có (Loud and Rich)GoMedium58.4%
0863Tất cả nút cách K trong cây nhị phân (All Nodes Distance K in Binary Tree)GoMedium62.3%
0872Cây lá tương tự (Leaf-Similar Trees)GoEasy67.6%
0897Cây tìm kiếm theo thứ tự tăng dần (Increasing Order Search Tree)GoEasy78.4%
0924Giảm thiểu lây lan mã độc (Minimize Malware Spread)GoHard42.1%
0928Giảm thiểu lây lan mã độc II (Minimize Malware Spread II)GoHard42.8%
0938Tổng đoạn trong BST (Range Sum of BST)GoEasy85.9%
0947Loại bỏ nhiều đá nhất với cùng hàng hoặc cột (Most Stones Removed with Same Row or Column)GoMedium58.9%
0959Các vùng bị cắt bởi dấu gạch chéo (Regions Cut By Slashes)GoMedium69.1%
0968Camera cây nhị phân (Binary Tree Cameras)GoHard46.6%
0971Lật cây nhị phân để khớp duyệt tiền thứ tự (Flip Binary Tree To Match Preorder Traversal)GoMedium50.0%
0979Phân phối xu trong cây nhị phân (Distribute Coins in Binary Tree)GoMedium72.2%
0987Duyệt theo cột dọc của cây nhị phân (Vertical Order Traversal of a Binary Tree)GoHard45.1%
0993Anh em họ trong cây nhị phân (Cousins in Binary Tree)GoEasy54.6%
1020Số lượng vùng đất bị cô lập (Number of Enclaves)GoMedium65.6%
1022Tổng số nhị phân từ gốc đến lá (Sum of Root To Leaf Binary Numbers)GoEasy73.5%
1026Hiệu lớn nhất giữa nút và tổ tiên (Maximum Difference Between Node and Ancestor)GoMedium75.8%
1028Khôi phục cây từ duyệt tiền thứ tự (Recover a Tree From Preorder Traversal)GoHard73.3%
1034Tô màu đường biên (Coloring A Border)GoMedium49.2%
1038Cây nhị phân tìm kiếm thành cây tổng lớn hơn (Binary Search Tree to Greater Sum Tree)GoMedium85.5%
1110Xóa nút và trả về rừng (Delete Nodes And Return Forest)GoMedium69.3%
1123Tổ tiên chung thấp nhất của các lá sâu nhất (Lowest Common Ancestor of Deepest Leaves)GoMedium70.9%
1145Trò chơi tô màu cây nhị phân (Binary Tree Coloring Game)GoMedium51.7%
1202Chuỗi nhỏ nhất sau khi hoán đổi (Smallest String With Swaps)GoMedium57.7%
1203Sắp xếp item theo nhóm và phụ thuộc (Sort Items by Groups Respecting Dependencies)GoHard51.2%
1254Số lượng đảo khép kín (Number of Closed Islands)GoMedium66.9%
1302Tổng các lá sâu nhất (Deepest Leaves Sum)GoMedium86.6%
1305Tất cả phần tử trong hai cây nhị phân tìm kiếm (All Elements in Two Binary Search Trees)GoMedium79.8%
1306Trò chơi nhảy III (Jump Game III)GoMedium63.5%
1319Số thao tác để kết nối mạng (Number of Operations to Make Network Connected)GoMedium62.1%
1600Thừa kế ngai vàng (Throne Inheritance)GoMedium63.6%
1631Đường đi với nỗ lực tối thiểu (Path With Minimum Effort)GoMedium55.7%
2096Hướng dẫn từng bước từ một nút của cây nhị phân tới nút khác (Step-By-Step Directions From a Binary Tree Node to Another)GoMedium48.5%
------------------------------------------------------------------------------------------------------------------------------------------------