--- left.rs 2020-04-25 23:42:33.000000000 +0700 | |
+++ right.rs 2020-04-25 23:48:14.000000000 +0700 | |
@@ -0,0 +1,15 @@ | |
+pub fn shunting_yard(_token_list: Vec<String>) -> Result<Vec<String>, String> { | |
+ return Err("Empty token list".to_owned()); | |
+} | |
+ | |
+#[cfg(test)] | |
+mod tests { | |
+ use super::*; |
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.
Suppose you have n
versions [1, 2, ..., n]
and you want to find out the first bad one, which causes all the following ones to be bad.
You are given an API bool isBadVersion(version)
which will return whether version
is bad. Implement a function to find the first bad version. You should minimize the number of calls to the API.
Example:
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.
Example 1:
Input: 5
Output: 2
Explanation: The binary representation of 5 is 101 (no leading zero bits), and its complement is 010. So you need to output 2.
You're given strings J
representing the types of stones that are jewels, and S
representing the stones you have. Each character in S
is a type of stone you have. You want to know how many of the stones you have are also jewels.
The letters in J
are guaranteed distinct, and all characters in J
and S
are letters. Letters are case sensitive, so "a"
is considered a different type of stone from "A"
.
Example 1:
Input: J = "aA", S = "aAAbbbb"
Output: 3