Skip to content

Instantly share code, notes, and snippets.

@amabirbd
Created February 15, 2023 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amabirbd/0a315cfdbe29b2133bdcb796b638c088 to your computer and use it in GitHub Desktop.
Save amabirbd/0a315cfdbe29b2133bdcb796b638c088 to your computer and use it in GitHub Desktop.
problem solving for airwrk
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