An open API service indexing awesome lists of open source software.

https://github.com/erikngigi/ona-kenya-internship-interview-questions


https://github.com/erikngigi/ona-kenya-internship-interview-questions

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

## Question 1

### Problem Statement

You are given an integer N, followed by N lines of input (1 <= N <= 100). Each line of input contains one number M.

Write a program that goes through the numbers from 1 to M (1 <= M <= 100) and prints out the following:

- For numbers which are multiples of three print "Ona".
- For numbers which are the multiples of five print "Data".
- For numbers which are multiples of both three and five print "OnaData".
- If the conditions above fail for all numbers, print "N/A".

---

## Question 2

### Problem Statement

You are given an integer N, followed by N lines of input (1 <= N <= 100). Each line of input contains one or several words separated with single spaces. Each word is a sequence of letters of the English alphabet containing between 1 and 10 characters, inclusive. The total number of words in the input is between 1 and 100, inclusive.

Your task is to reverse each word in each line of input while preserving the order of words in each line. The lines of your output should not have any trailing or leading spaces.

---

## Question 3

### Problem Statement

Write a program to find the sorted non-repeating intersection of two sorted arrays, one x elements long and another y elements long.

The input data consists of two lines of comma-separated characters.
Write a program to find the sorted non-repeating intersection of two sorted arrays, one x elements long and another y elements long.

**Example**

Input:

```
a,b,c,d,e,f,g,h,i
d,g,i,j,k,l,m
```

Output:

```
d,g,i
```

---

## Question 4

### Problem Statement

An array of integers a is called smooth if the absolute value of the difference between any two adjacent elements is less than or equal to 1. You are given an array a. Check whether it is smooth and output "YES" if it is, or "NO" if it is not (quotes for clarity only).

The first line of the input contains an integer N - the number of elements in the array. 1 <= N <= 10.
The second line of the input contains N integers - the elements of the array, separated with single spaces. 1 <= ai <= 10.