Coding Interview Resources: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 8: Line 8:
* Arrays have <code>.length</code>, Strings have <code>length()</code>
* Arrays have <code>.length</code>, Strings have <code>length()</code>
* Lists have <code>size()</code>
* Lists have <code>size()</code>
* Map has <code>containsKey(T key)</code>, <code>get(T key)</code>
* Map:
**<code>containsKey(T key)</code>
**<code>get(T key)</code>
**<code>Set<T> s = m.keySet()</code>
**<code>Collection<T> c = m.values()</code>
* Digit character (‘0’ – ‘9’) to its int value (int)c – 48 (‘0’ is 48, ‘9’ is 57, ‘A’ is 65)
* Digit character (‘0’ – ‘9’) to its int value (int)c – 48 (‘0’ is 48, ‘9’ is 57, ‘A’ is 65)
* LinkedList API (add(), iterate)
* LinkedList API (add(), iterate)
* <font color=red>List<Key>[] a; a = new List<Key>[10];</font>
* <font color=red>List<Key>[] a; a = new List<Key>[10];</font>
* <font color=red>The mathematics of a modulo of a negative number.</font>
* <font color=red>The mathematics of a modulo of a negative number.</font>
* [[Graph_as_Adjacency_Lists_in_Java|Graph adjacency list representation]].
* min(int a, int b, int c):
<syntaxhighlight lang='java'>
private static int min(int a, int b, int c) {
  int min = a;
  if (b < a) {
    min = b;
  }
  if (c < min) {
    min = c;
  }
  return min;
}
</syntaxhighlight>

Latest revision as of 20:40, 12 November 2021

Internal

Overview

  • Can this be turned into a graph problem? Can it be turned into a tree problem?
  • Java API call to get a String of certain length made of spaces.
  • Arrays have .length, Strings have length()
  • Lists have size()
  • Map:
    • containsKey(T key)
    • get(T key)
    • Set<T> s = m.keySet()
    • Collection<T> c = m.values()
  • Digit character (‘0’ – ‘9’) to its int value (int)c – 48 (‘0’ is 48, ‘9’ is 57, ‘A’ is 65)
  • LinkedList API (add(), iterate)
  • List<Key>[] a; a = new List<Key>[10];
  • The mathematics of a modulo of a negative number.
  • Graph adjacency list representation.
  • min(int a, int b, int c):
private static int min(int a, int b, int c) {
  int min = a;
  if (b < a) {
    min = b;
  }
  if (c < min) {
    min = c;
  }
  return min;
}