此主題將有三位參賽者共同參與,我們將合力完成三方共 90篇的鐵人文章(Java刷題A/B和C++刷題)。根據LeetCode Top 100 Liked題目集的脈絡,我們將介紹共十四種演算法,並透過Java和C++實作LeetCode上的題目。
二元搜尋法(Binary Search),又稱作折半搜尋法、對數搜尋法,適用於有序陣列中搜尋目標元素的演算法,此演算法每進行一次比較將使搜尋範圍縮小一半。搜尋的...
Problem : There is an integer array nums sorted in ascending order (with distinc...
Problem : Given a sorted array of distinct integers and a target value, return t...
Problem : You are given an m x n integer matrix matrix with the following two pr...
二元樹(Binary Tree),為各節點最多只有兩個子節點的樹結構,分別稱為左子節點和右子節點,左右子節點之間具有次序關係,左子節點在右子節點前,順序不可顛倒...
Problem : Given the root of a binary tree, determine if it is a valid binary sea...
Problem : Given the root of a binary tree, return the level order traversal of i...
Problem : Given the root of a binary tree, imagine yourself standing on the righ...
堆疊(stack),將資料有序排成一列且具有 後進先出 LIFO(Last In First Out) 的資料結構,通常以一維陣列或鏈結串列的方式呈現,規則是...
Problem : Given a string s containing just the characters '(', ')', '{', '}', '[...