From 6b7b6f9f1c1dc8a7f85b0bcae57d08767ec91848 Mon Sep 17 00:00:00 2001 From: luzhipeng Date: Wed, 24 Apr 2019 15:02:41 +0800 Subject: [PATCH] fix: typo --- problems/279.perfect-squares.md | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/problems/279.perfect-squares.md b/problems/279.perfect-squares.md index b4f35c3a5..a04cf3133 100644 --- a/problems/279.perfect-squares.md +++ b/problems/279.perfect-squares.md @@ -117,29 +117,6 @@ for (let i = 1; i <= n; i++) { * Output: 2 * Explanation: 13 = 4 + 9. */ - -const mapper = {}; - -function d(n, level) { - if (n === 0) return level; - - let i = 1; - const arr = []; - - while (n - i * i >= 0) { - const hit = mapper[n - i * i]; - if (hit) { - arr.push(hit + level); - } else { - const depth = d(n - i * i, level + 1) - level; - mapper[n - i * i] = depth; - arr.push(depth + level); - } - i++; - } - - return Math.min(...arr); -} /** * @param {number} n * @return {number}