Ad
  • Custom User Avatar

    Possibly yeah :/ I am just not sure why it spits out different results on different platforms

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    i honestly dont know why but i have corrected it. I just want to see the test that I failed so i can go over why they failed, is there any way to do that?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    anyway to get a pass for this code ^^

  • Custom User Avatar
    // Writing nessecary functions for later
    let isPower = (n) => { 
      if (n===1) {  
        return true; 
      }
      for (let x=2; x<=Math.sqrt(n); x++) { 
        let y = 2;
        let p = Math.pow(x, y);
        while (p<=n && p > 0) {
          if (p===n) {
            return true
          } else {
            y++;
            p = Math.pow(x, y);
          }
        }
    
      } 
      return false; 
    } 
    let pFac = (x,i,r) => {
      r=[];for(;x>=2;){for(i=2;x%i;++i);r.push(i);x/=i}return r}
    // end of prerequisite functions
    
    // Real stuff 
    let slayAchilles = (army) => {
      
      let powArmy = army.filter(y => {
      if (isPower(y) === true) {
        return true
      }
      let powers = pFac(y).reduce((end, num) => {
        if (num in end) {
        end[num]++;
        } else {
        end[num] = 1;
        }
        return end
      }, {})
        let vArr = Object.values(powers)
        if (vArr.length >= 2 && !vArr.includes(1)) {
          return false
        }
        return true
        })
    
      return powArmy
    }
    

    Yeah i figured a bit of it out and i think this code works its just that it exits the code on the 36th test. My code needs to be optimized apparently but i have no idea how lol.

  • Custom User Avatar

    sorry, now it is formatted properly

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Okay there you go. My code works with normal sentences and stuff. what does it mean for 'Ó6' to deeply equal 'hey'. When i run 'Ó6' through encoder and decoder it returns 'Ó6'. Isnt that the objective of this task?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    but what does it mean for 'Ó6' to deeply equal 'hey'? please help