Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (30 sloc) 807 Bytes

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);

You can’t perform that action at this time.