Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent deeac5a commit 6b7b6f9Copy full SHA for 6b7b6f9
problems/279.perfect-squares.md
@@ -117,29 +117,6 @@ for (let i = 1; i <= n; i++) {
117
* Output: 2
118
* Explanation: 13 = 4 + 9.
119
*/
120
-
121
-const mapper = {};
122
123
-function d(n, level) {
124
- if (n === 0) return level;
125
126
- let i = 1;
127
- const arr = [];
128
129
- while (n - i * i >= 0) {
130
- const hit = mapper[n - i * i];
131
- if (hit) {
132
- arr.push(hit + level);
133
- } else {
134
- const depth = d(n - i * i, level + 1) - level;
135
- mapper[n - i * i] = depth;
136
- arr.push(depth + level);
137
- }
138
- i++;
139
140
141
- return Math.min(...arr);
142
-}
143
/**
144
* @param {number} n
145
* @return {number}
0 commit comments