fork download
  1. public class ExactTreeEasy {
  2. public int[] getTree(int n, int m)
  3. {
  4. int[] ret = new int[(n-1)*2];
  5. int p = 0;
  6. ret[p++] = 0; ret[p++] = 1;
  7. ret[p++] = 1; ret[p++] = 2;
  8. int nodeIndex = 2;
  9. for(int i = 1; i <= m-2; i++)
  10. {
  11. ret[p++] = 1; ret[p++] = ++nodeIndex;
  12. }
  13. while(nodeIndex < n-1)
  14. {
  15. ret[p++] = nodeIndex; ret[p++] = ++nodeIndex;
  16. }
  17. return ret;
  18. }
  19. }
  20.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class ExactTreeEasy is public, should be declared in a file named ExactTreeEasy.java
public class ExactTreeEasy {
       ^
1 error
stdout
Standard output is empty