+ 1

Given an array of integers, find the numbers that appears an odd number of times return an array of the numbers.

input: [1,1,1,2,2,3,3,3,2] output: [1,2,3]

16th Aug 2020, 9:59 PM
notGreat
notGreat - avatar
10 odpowiedzi
0
Post your attempt first..
17th Aug 2020, 12:36 PM
Jayakrishna 🇮🇳
0
notGreat Pls tag the language also.. May you looking like this : for(i in obj){ if(obj[i].length % 2 !== 0 && obj[i].length != 1) num.push(+i); }
18th Aug 2020, 3:13 PM
Jayakrishna 🇮🇳
0
Jayakrishna🇮🇳 I don't completely know what your asking, but if that code is part of your solution to the asked problem then it's incorrect, you don't want to filter values with length not equal 1 you would want the first condition obj[I].length % 2 != 0 as 1 is an odd number, you can see that I had that idea on line 10 of my odd int problem
18th Aug 2020, 6:55 PM
notGreat
notGreat - avatar
0
Maria Vasilyova the problem is to determine if there is a number(s) in an array that appears an odd number of time you can view my solution on comment
18th Aug 2020, 7:03 PM
notGreat
notGreat - avatar
0
Jayakrishna🇮🇳 I completed the challenge in JavaScript but you can complete in whatever language you please
18th Aug 2020, 7:07 PM
notGreat
notGreat - avatar
0
notGreat That is a about, dublicate numbers printing.. Can you give an example which is you not getting write? With expected output?
23rd Aug 2020, 9:20 AM
Jayakrishna 🇮🇳