Given two integers a and b, return the sum of the two integers without using the operators + and -.
Example 1:
1 | Input: a = 1, b = 2 |
Example 2:
1 | Input: a = 2, b = 3 |
Given two integers a and b, return the sum of the two integers without using the operators + and -.
Example 1:
1 | Input: a = 1, b = 2 |
Example 2:
1 | Input: a = 2, b = 3 |
Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.
Example 1:
1 | Input: nums = [1,1,1,2,2,3], k = 2 |
Example 2:
1 | Input: nums = [1], k = 1 |
Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1’s in the binary representation of i.
Example 1:
1 | Input: n = 2 |
Example 2:
1 | Input: n = 5 |
Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.
Note that the same word in the dictionary may be reused multiple times in the segmentation.
Example 1:
1 | Input: s = "leetcode", wordDict = ["leet","code"] |
Example 2:
1 | Input: s = "applepenapple", wordDict = ["apple","pen"] |
Example 3:
1 | Input: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"] |