Question: Niro Money Recently Conducted Online Assessments, December, 2022 | Dates in Javascript | Not Very Interesting
3
Entering edit mode

Job Roles: Backend SDE 2 and Backend SDE 3

Location: Bangalore

Apply Here: Niro Money careers

Online Assessment Details:

  • Time: 1 hour
  • Questions: 5 MCQ, 2 Coding Questions

Question 1

Dates in Javascript

Being a developer, you should know to process a large number of records with scripts. You are given records of T customers of compnay. Each record has the following information in the following format:

<customer_name>,<customer_no>, <date_of_birth>,<record _processing_date>

Where:

  • <customer_name> : Name of customer, can contain one or many spaces separated by tuples having English lowercase/uppercase letters. For example "gopal" and "Ram Kumar" (spaces can be more than one)
  • <customer_no> : Enrollment number if customer, unique positive integer of atmost six digits.
  • <date_of_birth>: Date of birth of customer, format is dd.mm.yyyy where 1 <= dd <= 30, 1 <= mm <= 12, 1980 <= yyyy <= 2030
  • <record_processing_date> : Date of processing of record same format <date_of_birth>

Now the company wants to know the age of each customer to give them age specific offers. The age of the customer is calculated by counting the number of days between: <record_processing_date> and his <date_of_birth>

Given T such records, your task is to print the age (in number of days) of the customer for each record.

Input Format

  • The first line has T, the number of records
  • For next T lines, each line has a customer record in the specified format.

Constraints

  • 1 <= T <= 50
  • All dates will be valid dates

Output Format

  • For each record, print age (in number of days) of the customer

Evaluation Parameters

Sample Input

2
Ram Kumar, 134, 20.5.1994, 20.4.2002
gopal, 24, 31.12.1995, 21.02.2017

Sample Output

2892
7723

Explanation

The difference between dates 20.4.2002 and 20.5.1994 is 2921 days. And the difference between dates 21.02.2017 and 31.12.1995 is 7723 days.

Question 2

Not Very Interesting

The main occupation of the citizens of Numberland is to perform tasks on numbers. One such important task is finding interesting number sequences. As per the Numberland Institute of Research, an interesting sequence is defined as a sequence of numbers that are consecutive, for example:

1    2    3    4    5    6
10      11      12     13

are interesting sequences. Mathematically an interesting sequence has the following generic property: ni+1 = ni+1

The task faced by the research is as follows: Given an ordered set of distinct numbers, extract the length of the largest interesting sequence that can be obtained by rearranging the set of numbers.

Help the research the institute in finding the longest interesting subsequences.

Input Format:

  • The input consists of two lines
  • The first line contains N the length of the input sequence
  • The second line of input contains of N numbers the sequence of numbers that must be analyzed

Constraints:

  • 0 <= N <= 1000
  • If Ki be ith element in the sequence, 1 <= Ki <= 2000

Evaluation Parameters

Sample Input

11
15  17  13  16  14  3  4  6  1  2  5

Sample Output

6

Here we can re-arrange the sequence as

13  14  15  16  17  1  2  3  4  5  6

Observe that there are two interesting sequences

1  2   3  4  5  6

and

13   14   15   16    17

Sequence 1 2 3 4 5 6 is maximal length therefore the answer is 6

ADD COMMENTlink 2.0 years ago John 910

Login before adding your answer.

Similar Posts
Loading Similar Posts