Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

Coding

Example Question:

  • Make assumptions
  • If they tell you are taking input from STDIN, start by just taking input from a string.
  • Write example cases as comments, or part of the code execution. This gives discussion points.
  • Explain assumptions about validity of input
  • Create an assert function, which takes in the expected result given an input. See PHP or JS
input = "a b c d e";

main(input) {
  ...
}

assert(expected, input) {
  console.log(input);
  actual = main(input);
  result = expected === actual;
  console.log(result);
  if (!result) {
    console.log(actual);
    console.log(expected);
  }
}

// Case 1
assert(expected, input);

// Case 2
assert(expected2, input2);

// Case 3
assert(expected3, input3);