Created
February 15, 2023 17:12
-
-
Save amabirbd/0a315cfdbe29b2133bdcb796b638c088 to your computer and use it in GitHub Desktop.
problem solving for airwrk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isPalindrome(val) { | |
let str = val.toString(); | |
let rev = str.split("").reverse().join(""); | |
return str === rev; | |
} | |
console.log(isPalindrome(129)) | |
function findTriplets(arr) { | |
for(let i=0; i<arr.length -2; i++) { | |
} | |
} | |
function problemThree(nums) { | |
let newNums = nums; | |
for(let i=0; i<nums.length; i++) { | |
if(nums[i]<10) { | |
newNums.push(nums[i]) | |
} | |
newNums.push(parseInt(nums[i].toString().split(",").reverse().join(","))) | |
} | |
return newNums; | |
} | |
console.log(problemThree([1,2,3,23])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment