Skip to content

Incorrect return values #7

Description

@PlytonRexus

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions