7 kyu

Array element parity

3,987 of 9,459KenKamau

Description:

In this Kata, you will be given an array of integers whose elements have both a negative and a positive value, except for one integer that is either only negative or only positive. Your task will be to find that integer.

Examples:

[1, -1, 2, -2, 3] => 3

3 has no matching negative appearance

[-3, 1, 2, 3, -1, -4, -2] => -4

-4 has no matching positive appearance

[1, -1, 2, -2, 3, 3] => 3

(the only-positive or only-negative integer may appear more than once)

Good luck!

Arrays
Algorithms

Stats:

CreatedNov 13, 2017
PublishedNov 24, 2017
Warriors Trained14892
Total Skips245
Total Code Submissions24562
Total Times Completed9459
JavaScript Completions3987
Python Completions2890
Ruby Completions285
C# Completions532
Haskell Completions119
C Completions183
Elixir Completions38
C++ Completions563
Java Completions830
Go Completions275
Rust Completions131
Clojure Completions29
Total Stars142
% of votes with a positive feedback rating94% of 1414
Total "Very Satisfied" Votes1255
Total "Somewhat Satisfied" Votes144
Total "Not Satisfied" Votes15
Total Rank Assessments3
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • KenKamau Avatar
  • raulbc777 Avatar
  • imjasonmiller Avatar
  • Souzooka Avatar
  • rowcased Avatar
  • rsa Avatar
  • hobovsky Avatar
  • solitude Avatar
  • username0 Avatar
  • DVYKPABQDG Avatar
  • mauro-1 Avatar
  • PetitLu117 Avatar
Ad