jas0nhuang

Don't LeetCode Yet - 3 - Understand the Problem

Reading comprehension? Yes! and No! Also pay attention to input range.

Translate the problem into simple language

LIOJ problem 1008

Know the input range? Maximum exponent 31 of 2.

3 main limitations

  1. Space (memory space)
    int: 4 bytes
    double: 8 bytes
    Number in JavaScript: 8 bytes
  2. Time
    Not very important for beginner.
    big O
  3. Type
    data type:
    int: -2 ^ 31 ~ 2 ^ 31
    Max integer in JavaScript: Number.MAX_SAFE_INTEGER
    floating point numbers precision problem

IMPORTANT! Know the range before coding!

Know the input/output method

Project 3

LIOJ problem 1010

Simply check if two numbers are the same.
In a safe number range.

LIOJ problem 1015

Calculate the distance
Number range is also safe.

###LIOJ problem 1017
Maximum thief capacity 1000
Maximum value 100000
Maximum total value 10 ^ 8
declare 1000 variables?
.sort() and splice()
items in store might be less then what a thief can take