Skip to main content
Commonmark migration
Source Link

#JavaScript (ES6), 37 bytes

JavaScript (ES6), 37 bytes

Returns false for Noah or true for non-Noah.

a=>a.some(v=>a.map(x=>t-=v==x,t=2)|t)

Try it online!

###Commented

Commented

a =>               // a[] = input
  a.some(v =>      // for each value v in a[]:
    a.map(x =>     //   for each value x in a[]:
      t -= v == x, //     decrement t if v is equal to x
                   //     (i.e. if v appears exactly twice, t is decremented twice)
      t = 2        //     start with t = 2
    )              //   end of map()
    | t            //   yield t, which is supposed to be equal to 0
  )                // end of some()

#JavaScript (ES6), 37 bytes

Returns false for Noah or true for non-Noah.

a=>a.some(v=>a.map(x=>t-=v==x,t=2)|t)

Try it online!

###Commented

a =>               // a[] = input
  a.some(v =>      // for each value v in a[]:
    a.map(x =>     //   for each value x in a[]:
      t -= v == x, //     decrement t if v is equal to x
                   //     (i.e. if v appears exactly twice, t is decremented twice)
      t = 2        //     start with t = 2
    )              //   end of map()
    | t            //   yield t, which is supposed to be equal to 0
  )                // end of some()

JavaScript (ES6), 37 bytes

Returns false for Noah or true for non-Noah.

a=>a.some(v=>a.map(x=>t-=v==x,t=2)|t)

Try it online!

Commented

a =>               // a[] = input
  a.some(v =>      // for each value v in a[]:
    a.map(x =>     //   for each value x in a[]:
      t -= v == x, //     decrement t if v is equal to x
                   //     (i.e. if v appears exactly twice, t is decremented twice)
      t = 2        //     start with t = 2
    )              //   end of map()
    | t            //   yield t, which is supposed to be equal to 0
  )                // end of some()
added a commented version
Source Link
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

#JavaScript (ES6), 37 bytes

Returns false for Noah or true for non-Noah.

a=>a.some(v=>a.map(x=>t-=v==x,t=2)|t)

Try it online!

###Commented

a =>               // a[] = input
  a.some(v =>      // for each value v in a[]:
    a.map(x =>     //   for each value x in a[]:
      t -= v == x, //     decrement t if v is equal to x
                   //     (i.e. if v appears exactly twice, t is decremented twice)
      t = 2        //     start with t = 2
    )              //   end of map()
    | t            //   yield t, which is supposed to be equal to 0
  )                // end of some()

#JavaScript (ES6), 37 bytes

Returns false for Noah or true for non-Noah.

a=>a.some(v=>a.map(x=>t-=v==x,t=2)|t)

Try it online!

#JavaScript (ES6), 37 bytes

Returns false for Noah or true for non-Noah.

a=>a.some(v=>a.map(x=>t-=v==x,t=2)|t)

Try it online!

###Commented

a =>               // a[] = input
  a.some(v =>      // for each value v in a[]:
    a.map(x =>     //   for each value x in a[]:
      t -= v == x, //     decrement t if v is equal to x
                   //     (i.e. if v appears exactly twice, t is decremented twice)
      t = 2        //     start with t = 2
    )              //   end of map()
    | t            //   yield t, which is supposed to be equal to 0
  )                // end of some()
saved 1 byte
Source Link
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

#JavaScript (ES6), 3837 bytes

Returns a Boolean valuefalse for Noah or true for non-Noah.

a=>!aa=>a.some(v=>a.map(x=>t-=v==x,t=2)|t)

Try it online!Try it online!

#JavaScript (ES6), 38 bytes

Returns a Boolean value.

a=>!a.some(v=>a.map(x=>t-=v==x,t=2)|t)

Try it online!

#JavaScript (ES6), 37 bytes

Returns false for Noah or true for non-Noah.

a=>a.some(v=>a.map(x=>t-=v==x,t=2)|t)

Try it online!

Source Link
Arnauld
  • 197.8k
  • 20
  • 180
  • 650
Loading