題目描述 給定一個(gè)單向鏈表,要求刪除從結(jié)尾數(shù)第n個(gè)結(jié)點(diǎn),并返回修改后的表頭。 樣例 給定數(shù)組單向鏈表 1->2->3->4->5 ,以及 n = 2 ,修改后的鏈表為 1->...
題目描述 給定一個(gè)單向鏈表,要求刪除從結(jié)尾數(shù)第n個(gè)結(jié)點(diǎn),并返回修改后的表頭。 樣例 給定數(shù)組單向鏈表 1->2->3->4->5 ,以及 n = 2 ,修改后的鏈表為 1->...
[LeetCode] Strobogrammatic Number 對(duì)稱數(shù) A strobogrammatic number is a number that looks t...
題目:題目地址 題目描述請(qǐng)?jiān)O(shè)計(jì)一個(gè)棧結(jié)構(gòu),支持 push、pop、top以及getMin操作,且每個(gè)操作的時(shí)間復(fù)雜度都是 O(1)O(1)。push(x) – 向棧中壓入元素...
模擬人工加法的過(guò)程。 從低位到高位,依次計(jì)算出每一位數(shù)字,過(guò)程中需要記錄進(jìn)位。如果最高位進(jìn)位是1,則需要將整個(gè)數(shù)組后移一位,并在第0個(gè)位置寫(xiě)上1。
使用棧數(shù)據(jù)結(jié)構(gòu): 遇到左括號(hào),需要壓棧。 遇到右括號(hào),判斷棧頂是否和當(dāng)前右括號(hào)匹配;若不匹配則返回false,否則匹配彈出棧頂。 最后判斷棧是否為空;若為空則合法,否則不合法。
leetcode Day 4 題目:Given an array nums, write a function to move all 0's to the end of i...
Question 求二叉樹(shù)的最大深度 Given a binary tree, find its maximum depth.The maximum depth is the...
正在復(fù)習(xí)C++,有理解不對(duì)的地方歡迎大家指正~
104. Maximum Depth of Binary TreeLeetcode Day 3 題目:Given a binary tree, find its maximum depth.The maximum depth is the ...
Leetcode Day 3 題目:Given a binary tree, find its maximum depth.The maximum depth is the ...
Leetcode Day 2 題目:The Hamming distance between two integers is the number of positions ...
題目:You're given strings J representing the types of stones that are jewels, and S repre...
Leetcode Day 1 136 Single Number 題目: Given a non-empty array of integers, every element...
Leetcode Day 1 344 Reverse String 題目:Write a function that takes a string as input and ...