-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexpression-add-operators.js
More file actions
53 lines (51 loc) · 1.16 KB
/
expression-add-operators.js
File metadata and controls
53 lines (51 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* Source: https://leetcode.com/problems/expression-add-operators/
* Tags: [Divide and Conquer]
* Level: Hard
* Title: Expression Add Operators
* Auther: @imcoddy
* Content: 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.
*
*
* Examples:
* "123", 6 -> ["1+2+3", "1*2*3"]
* "232", 8 -> ["2*3+2", "2+3*2"]
* "105", 5 -> ["1*0+5","10-5"]
* "00", 0 -> ["0+0", "0-0", "0*0"]
* "3456237490", 9191 -> []
*
*
* Credits:Special thanks to @davidtan1890 for adding this problem and creating all test cases.
*
*
* Subscribe to see which companies asked this question
*
*
*
*
*
*
*
*
*
*
*
*
* Show Similar Problems
*
*
* (M) Evaluate Reverse Polish Notation
*
* (M) Basic Calculator
*
* (M) Basic Calculator II
*
* (M) Different Ways to Add Parentheses
*/
/**
* @param {string} num
* @param {number} target
* @return {string[]}
*/
var addOperators = function(num, target) {
};