Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect return values #7

Open
PlytonRexus opened this issue Aug 18, 2021 · 0 comments
Open

Incorrect return values #7

PlytonRexus opened this issue Aug 18, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@PlytonRexus
Copy link

PlytonRexus commented Aug 18, 2021

Writing this in a hurry, so cannot be sure, but I noticed that return values were wrong for the following program. (I'll update as soon as I can). Find a screenshot and the code below.

(Great tool, btw!)

function fn(n) {
  Array.prototype.size = function() {
    return this.length
  }
  
  ans = new Array(n)
  
  if(n == 0)
    return ans;
  if(n==1)
    return [0,1];
      
  ans = fn(n-1);
  for(let i = ans.size()-1;i >= 0; i--)
    ans.push(ans[i] | 1<<n-1);
  return ans;
}

image

@PlytonRexus PlytonRexus changed the title Probably incorrect return values Incorrect return values Aug 18, 2021
@brpapa brpapa self-assigned this Sep 7, 2021
@brpapa brpapa added the bug Something isn't working label Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants