C++
LeetCode: 81-Search in Rotated Sorted Array II 解題紀錄
題目
There is an integer array nums
sorted in non-decreasing order (not necessarily with distinct values).
LeetCode: 1337-The K Weakest Rows in a Matrix 解題紀錄
題目
You are given an m x n
binary matrix mat
of 1
‘s (representing soldiers) and 0
‘s (representing civilians). The soldiers are positioned in front of the civilians. That is, all the 1
‘s will appear to the left of all the 0
‘s in each row.
LeetCode: 704-Binary Search 解題紀錄
題目
Given an array of integers nums
which is sorted in ascending order, and an integer target
, write a function to search target
in nums
. If target
exists, then return its index. Otherwise, return -1
.
LeetCode: 1029-Two City Scheduling 解題紀錄
題目
A company is planning to interview 2n
people. Given the array costs
where costs[i] = [aCosti, bCosti]
, the cost of flying the ith
person to city a
is aCosti
, and the cost of flying the ith
person to city b
is bCosti
.
LeetCode: 881-Boats to Save People 解題紀錄
題目
You are given an array people
where people[i]
is the weight of the ith
person, and an infinite number of boats where each boat can carry a maximum weight of limit
. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most limit
.
LeetCode: 991-Broken Calculator 解題紀錄
題目
There is a broken calculator that has the integer startValue
on its display initially. In one operation, you can:
LeetCode: 1663-Smallest String With A Given Numeric Value 解題紀錄
題目
The numeric value of a lowercase character is defined as its position (1-indexed)
in the alphabet, so the numeric value of a
is 1
, the numeric value of b
is 2
, the numeric value of c
is 3
, and so on.
LeetCode: 763-Partition Labels 解題紀錄
題目
You are given a string s
. We want to partition the string into as many parts as possible so that each letter appears in at most one part.
LeetCode: 1007-Minimum Domino Rotations For Equal Row 解題紀錄
題目
In a row of dominoes, tops[i]
and bottoms[i]
represent the top and bottom halves of the ith
domino. (A domino is a tile with two numbers from 1 to 6 – one on each half of the tile.)