Leetcode 1-10
這篇文章介紹Leetcode1到10題的解決思路和相關程式碼。 1. Two sum 問題描述:給定一個整數陣列,返回兩個數字的索引,使它們加起來等於一個特定的目標。 例子: Given num
這篇文章介紹Leetcode1到10題的解決思路和相關程式碼。 1. Two sum 問題描述:給定一個整數陣列,返回兩個數字的索引,使它們加起來等於一個特定的目標。 例子: Given num
412. Fizz Buzz 題目連結 412. Fizz Buzz 題目分析 這個題目也很簡單。 從1逐個輸出到給定陣列,但逢3輸出Fizz,逢5輸出Buzz,逢15輸出F
題目要求 A sequence of number is called arithmetic if it consists of at least three elements and if the dif
本文題解 leetcode 如下: 121 Best Time to Buy and Sell Stock 122 Best Time to Buy and Sell Stock II
給定一個整型陣列,在陣列中找出由三個陣列成的最大乘積,並輸出這個乘積。 複製程式碼 示例: 輸入: [1,2,3] 輸出: 6 輸入: [1,2,3,4] 輸出: 24 複製程式碼 思考: 最
575. Distribute Candies 題目連結 575. Distribute Candies 題目分析 給定一個偶數長度的陣列,不同數字代表不同型別的糖果。 這一
914.卡牌分組 題目 給定一副牌,每張牌上都寫著一個整數。 此時,你需要選定一個數字X ,使我們可以將整副牌按下述規則分成 1 組或更多組: X 僅當你可選的
問題: A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bott
給定一顆二叉搜尋樹,重新進行排序,使其根節點是最小值,且每個節點都沒有左子樹,只有一個右子樹,最終還要保持該樹是一顆二叉搜尋樹. 例 1: 給予樹: 5
題目要求 Given a non-empty string containing an out-of-order English representation of digits 0-9, output t
前言 部落格裡新開一個“用python手刃Leetcode”的專題,顧名思義,主要目的是記錄自己在Leetcode上刷題的過程,程式碼全程用python3編寫,所用網址是:leetcode中國。
給定一個字串來代表一個學生的出勤記錄,這個記錄僅包含以下三個字元: 'A' : Absent,缺勤 'L' : Late,遲到 'P' : Present,到場
Time:2019/4/17 Title: sqrt(x) Difficulty: Easy Author: 小鹿 題目:sqrt(x) Implementi
題目要求 A frog is crossing a river. The river is divided into x units and at each unit there may or may no
求陣列中元素相加所能取得的最大值,這些元素必須相臨,複雜度為O(n) Example Input: [-2,1,-3,4,-1,2,1,-5,4], Output: