Posts

Showing posts with the label tiktok

1229. Meeting Scheduler

https://leetcode.com/problems/meeting-scheduler/description/ Given the availability time slots arrays  slots1  and  slots2  of two people and a meeting duration  duration , return the  earliest time slot  that works for both of them and is of duration  duration . If there is no common time slot that satisfies the requirements, return an  empty array . The format of a time slot is an array of two elements  [start, end]  representing an inclusive time range from  start  to  end . It is guaranteed that no two availability slots of the same person intersect with each other. That is, for any two time slots  [start1, end1]  and  [start2, end2]  of the same person, either  start1 > end2  or  start2 > end1 .   Example 1: Input: slots1 = [[10,50],[60,120],[140,210]], slots2 = [[0,15],[60,70]], duration = 8 Output: [60,68] Example 2: Input: slots1 = [[10,50],[60,120],[140,210]], ...

282. Expression Add Operators

https://leetcode.com/problems/expression-add-operators/ Given a string that contains only digits  0-9  and a target value, return all possibilities to add  binary  operators (not unary)  + ,  - , or  *  between the digits so they evaluate to the target value. Example 1: Input: num = "123", target = 6 Output: ["1+2+3", "1*2*3"] Example 2: Input: num = "232", target = 8 Output: ["2*3+2", "2+3*2"] Example 3: Input: num = "105", target = 5 Output: ["1*0+5","10-5"] Example 4: Input: num = "00", target = 0 Output: ["0+0", "0-0", "0*0"] Example 5: Input: num = "3456237490", target = 9191 Output: [] ---  Clarifying questions Can target overflow integer range Can we assume operators are to be single digits only, not combination of more than one digit ---