GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — leetcode/263.ugly-number.js at master · hungry-python/leetcode Expand file tree/ Copy path263.ugly-number.jsMore file actions 23 lines (20 loc) · 406 Bytes / Copy path263.ugly-number.jsFile metadata and controls23 lines (20 loc) · 406 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 /* * @lc app=leetcode id=263 lang=javascript * * [263] Ugly Number */ /** * @param {number} num * @return {boolean} */ var isUgly = function(num) { // TAG: 数论 if (num <= 0) return false; if (num === 1) return true; const list = [2, 3, 5]; if (list.includes(num)) return true; for (let i of list) { if (num % i === 0) return isUgly(Math.floor(num / i)); } return false; }; |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |