-1

I am not so good in math and I have an interview question to answer but I can`t understand this equation: the interview question is: write a function that, given an integer N(1 <= N <= 100) returns array containing N unique integer that sum up to 0.

I cant understand it to solve it please help what N(1 <= N <= 100) this mean.

P.S: I am not looking for ready solution, I want understand the concept so I can solve it my self. Thanks.

Edit: its not a range from 1,100 as you`re suggesting, here is the question image enter image description here

Jason Nues
  • 19
  • 2
  • 8

2 Answers2

0

It means that both (1 <= N) and (N <= 100). So N is an integer from 1 to 100.

Kyle W
  • 3,702
  • 20
  • 32
0
N(1 <= N <= 100)

simply means that you have a number N that is greater or equal to 1 and smaller or equal to 100.

In other words, it is an integer from 1 to 100 with both bounds inclusive.

It can also be written like that: N ∈ [1, 100] ∩ ℤ or N ∈ {x ∈ ℤ: 1 ≤ x ≤ 100}

dan1st
  • 12,568
  • 8
  • 34
  • 67
  • Well, typically [1, 100] is the set (an *interval*) of all *real* numbers between 1 and 100, so slightly more accurate would be "N ∈ [1, 100] ∩ ℤ". Also, your second version uses or (∨) but should use and (∧), and its syntax is slightly odd. The vertical bar is typically part of the set-builder notation, but you are missing the set brackets. More standard would be N ∈ {x ∈ ℤ : 1 ≤ x ∧ x ≤ 100}, or, much more natural, N ∈ {x ∈ ℤ: 1 ≤ x ≤ 100}, but this is too verbose. The original version given by the OP is the best one, if only you add the missing space! – Andreas Rejbrand Mar 06 '20 at 20:46
  • @AndreasRejbrand You are completely right - that's the result of copying the characters from wikipedia on a mobile phone... – dan1st Mar 06 '20 at 20:49
  • Sorry, but now it got even worse! :( "1<=N ∩ N<=100" doesn't make sense. ∩ is set intersection, so the things next to this symbol must be sets, but they are propositions in this case, so you need the logical and operator ∧. (But semantically, they are related: {x ∈ X: P(x) ∧ Q(x)} = {x ∈ X: P(x)} ∩ {x ∈ X: Q(x)}.) – Andreas Rejbrand Mar 06 '20 at 20:50
  • Now, I just copied the expression from you because I didn't want to fight against my mobile :) – dan1st Mar 06 '20 at 20:52