Hackerrank “30 Days of Code” Çözümleri – Day 21: Generics

Hackerrank’in 30 Days of Code içerisinde bulunan “Day 21: Generics” sorusunun açıklaması ve çözümü. Bu soruda generics kavramına göz attık.

► Hackerrank 30 Days of Code Çözümleri – Day 21: Generics: https://www.hackerrank.com/challenges/30-generics/problem

► Problem açıklaması:


Today we’re discussing Generics; be aware that not all languages support this construct, so fewer languages are enabled for this challenge. Check out the Tutorial tab for learning materials and an instructional video!


Write a single generic function named printArray; this function must take an array of generic elements as a parameter (the exception to this is C++, which takes a vector). The locked Solution class in your editor tests your function.

Note: You must use generics to solve this challenge. Do not write overloaded functions.

Input Format

The locked Solution class in your editor will pass different types of arrays to your printArray function.


You must have exactly 1 function named printArray.

Output Format

Your printArray function should print each element of its generic array parameter on a new line.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.