IDS-3250 Lecture Notes - Lecture 1: Standard Streams, Node.Js
Document Summary
** an array a consisting of n integers is given. A triplet (p, q, r) is triangular if it is possible to build a triangle with sides of lengths a[p], a[q] and a[r]. In other words, triplet (p, q, r) is triangular if 0 p < q < r < n and: A[r] + a[p] > a[q]. function solution(a) { var a0 = a. length; var tricount =0; **a non-empty array a consisting of n numbers is given. The absolute distinct count of this array is the number of distinct absolute values among the elements of the array. The absolute distinct count of this array is 5, because there are 5 distinct absolute values among the elements of this array, namely 0, 1, 3, 5 and 6. Write a function: function solution(a) { var r = []; for(var i = 0; i < a. length; i++) if(!r. includes(math. abs(a[i]))){ r. push(math. abs(a[i])); return r. length; **let a be a non-empty array consisting of n integers.