LeetCode: 1046-Last Stone Weight 解題紀錄
題目
You are given an array of integers stones
where stones[i]
is the weight of the ith
stone.
You are given an array of integers stones
where stones[i]
is the weight of the ith
stone.
Given a string s
, return true
if the s
can be palindrome after deleting at most one character from it.
Write a function that reverses a string. The input string is given as an array of characters s
.
There is an integer array nums
sorted in non-decreasing order (not necessarily with distinct values).
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.
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
.
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
.
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
.
There is a broken calculator that has the integer startValue
on its display initially. In one operation, you can: