What's the deal with Deno? We talk with a major contributor to find out. Listen now.

New answers tagged

1

To write the profit as a mathematical expression, you need to set up a little more notation for the buys and sells. Let $x[1], \ldots, x[n]$ be the stock prices on days $1, \ldots, n$. For each buy and sell, let $b$ denote the day on which the stock is bought, and $s$ the day on which it is sold. The problem says that we must have $1 \leq b < s \leq n$. ...


0

Array: maps consecutive integers to array elements. Often maps integers fro 0 to n-1. Arrays may have fixed or variable size, depending on the implementation. List: A list is either empty, or it has a first element, and each element except the last has a link to the next element. Allows inserting and removing elements. Depending on the implementation, ...


1

The objects you mention are not the same. In particular, lists and (mutable) strings are dynamic data structures whereas arrays are not; their size is fixed. Now, whether some set of instances of data structures forms a vector space depends on the underlying types, some do, others do not. Considering e.g. boolean arrays of fixed size $n$ together with the ...


2

Computers usually deal with floating-point numbers rather than with fractions. The main difference is that floating-point numbers have limited accuracy, but are much faster to perform arithmetic with (and are the only type of non-integer numbers supported natively in hardware). Floating-point numbers are stored in "scientific notation" with a fixed ...


Top 50 recent answers are included