iT邦幫忙

c++相關文章
共有 449 則文章

技術 C++ lambda test code

#include <algorithm> #include <iostream> #include <functional&gt...

技術 (C++)如何將指定時間日期轉換成UNIX時間&如何將UNIX時間轉換成日期

雖然稱不上多難,但是找可用的方法東拼西湊還是要花點時間,紀錄一下幫看到這篇的人省點時間需求:C++語言標準ISO C++20只使用STL庫,不需額外Librar...

技術 [LeetCode] 13. Roman to Integer

MediumRelated Topics: Hash Table / Math / StringLeetCode Source 解題想法 LeetCode...

技術 Leetcode 中文。你可能只花一分鐘寫完程式碼,但是比較困難在於閱讀英文題目。

歐氏定理: 「英文文法跟中文是相反的。」Return true if s is an acronym of words, and false otherwise...

技術 [LeetCode] 42. Trapping Rain Water

HardRelated Topics: Array / Two Pointers / Dynamic Programming / Stack / Monoto...

技術 [LeetCode] 135. Candy

HardRelated Topics: Array / GreedyLeetCode Source 解題想法 首先先確認 len(ratings),如果小於...

技術 [LeetCode] 134. Gas Station

MediumRelated Topics: Array / GreedyLeetCode Source 解題想法 這題是看之前解的方法 Python cl...

技術 [LeetCode] 238. Product of Array Except Self

MediumRelated Topics: Array / Prefix SumLeetCode Source 解題想法 這題我是看別人解法 原本以為要用...

技術 [LeetCode] 380. Insert Delete GetRandom O(1)

MediumRelated Topics: Array / Hash Table / Math / Design / RandomizedLeetCode S...

技術 [LeetCode] 274. H-Index

MediumRelated Topics: Array / Sorting / Counting SortLeetCode Source 解題想法 這題我卡...

技術 [LeetCode] 45. Jump Game II

MediumRelated Topics: Array / Dynamic Programming / GreedyLeetCode Source 解題想法...

技術 [LeetCode] 55. Jump Game

MediumRelated Topics: Array / Dynamic Programming / GreedyLeetCode Source 解題想法...

技術 [LeetCode] 122. Best Time to Buy and Sell Stock II

MediumRelated Topics: Array / Dynamic Programming / GreedyLeetCode Source 解題想法...

技術 [LeetCode] 121. Best Time to Buy and Sell Stock

EasyRelated Topics: Array / Dynamic ProgrammingLeetCode Source 解題想法 當下想到最直覺的解法...

技術 [LeetCode] 189. Rotate Array

MediumRelated Topics: Array / Math / Two PointersLeetCode Source 解題想法 這裡初始化 l...

技術 [LeetCode] 169. Majority Element

EasyRelated Topics: Array / Hash Table / Divide and Conquer / Sorting / Countin...

技術 [LeetCode] 80. Remove Duplicates from Sorted Array II

MediumRelated Topics: Array / Two PointersLeetCode Source 解題想法 這題跟昨天類似,但可重複的數字...

技術 [LeetCode] 26. Remove Duplicates from Sorted Array

EasyRelated Topics: Array / Two PointersLeetCode Source 解題想法 這題有 Hint 我有看一下 XD...

技術 [LeetCode] 27. Remove Element

EasyRelated Topics: Array / Two PointersLeetCode Source 解題想法 題目除了要回傳最後 nums 的長...

技術 [LeetCode] Top Interview 150 Series

題目來源自 Top Interview 150。 Table of Contents 88. Merge Sorted Array 27. Remove...

技術 [LeetCode] 88. Merge Sorted Array

EasyRelated Topics: Array / Two Pointers / SortingLeetCode Source 解題想法 題目要求要 i...

鐵人賽 自我挑戰組 DAY 30
Effective C++ 讀書筆記 系列 第 30

技術 [Day 30] Declare data members private

前言 不知不覺就第30天了~有始有終地來看看今天的守則吧!今天要介紹的是第22條守則~ 相對來說簡單明瞭好實踐,就抱著輕鬆的心情來看看背後的道理吧! 為什麼不要...

鐵人賽 自我挑戰組 DAY 29
Effective C++ 讀書筆記 系列 第 29

技術 [Day 29] Don't try to return a reference when you must return an object

前言 今天的守則接續昨天的內容,昨天提到的是盡量pass by reference,今天則是反過來提醒不要走火入魔該return object的時候也retur...

鐵人賽 自我挑戰組 DAY 28
Effective C++ 讀書筆記 系列 第 28

技術 [Day 28] Prefer pass-by-reference-to-const to pass-by-value (2)

前言 昨天介紹了盡量pass by reference by const這條守則,並說明它可以bypass掉昂貴的construct, destruct操作,也...

鐵人賽 自我挑戰組 DAY 27
Effective C++ 讀書筆記 系列 第 27

技術 [Day 27] Prefer pass-by-reference-to-const to pass-by-value (1)

前言 今天的守則是討論function中的parameter傳遞的方式,傳參數的時候可能沒想太多就直接把要用的東西傳入,今天就來看看其中可能更好的做法~ Pas...

鐵人賽 自我挑戰組 DAY 26
Effective C++ 讀書筆記 系列 第 26

技術 [Day 26] Treat class design as type design

前言 今天的守則有點像是一個check list,列了各種設計class時應該要思考的問題,就來看看有哪些要注意的吧! 設計class前不得不自問的 11+1...

鐵人賽 自我挑戰組 DAY 25
Effective C++ 讀書筆記 系列 第 25

技術 [Day 25] Make interfaces easy to use correctly and hard to use incorrectly (2)

前言 今天,我們接續昨天介紹的守則,繼續來看看更具體 "Make interfaces easy to use correctly and hard...

鐵人賽 自我挑戰組 DAY 24
Effective C++ 讀書筆記 系列 第 24

技術 [Day 24] Make interfaces easy to use correctly and hard to use incorrectly (1)

前言 終於進入第四章了!第四章的主題是 "Designs and Declarations,是關於 設計與宣告好的C++介面的一些重點,最一開始是所有...

鐵人賽 自我挑戰組 DAY 23
Effective C++ 讀書筆記 系列 第 23

技術 [Day 23] Store new objects in smart pointers in standalone statements

前言 不知不覺就直接來到第三章最後一個守則了!今天的守則雖然簡單,但乍看之下不會直接想到原因,書中詳盡解釋了其中的道理,讓人有輕鬆掌握到知識的感覺XD 就來看看...

鐵人賽 自我挑戰組 DAY 22
Effective C++ 讀書筆記 系列 第 22

技術 [Day 22] Use the same form in corresponding uses of new and delete

前言 今天介紹的是資源管理中,delete要注意是否需要delete [],一起來看看吧! 是不是array? new與delete請一致 今天的守則是: U...