Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: Coding - Questions
Description: This is coding questions if you solve then your coding skill move into next level.

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


1:1 MOCK SESSION

WWW
...
IN

1:1 MOCK SESSION

Capgemini Coding CheatSheet
1
...
You’re supposed to reduce the size of this string using

D
IN
G

mathematical logic given as in the example below :
Input :
aabbbbeeeeffggg
Output:

2
...


Input
5 4

IM
E

Sample Input

1 2 3 4

5 6 7 8

PR

9   10 11 12

13 14 15 16

17 18 19 20
Output

1  2  3  4  8  12  16  20  19  18  17  13  9  5  6  7  11  15  12  14 10

3
...
PRIMCECODING
...
PRIMCECODING
...

Example
Input :
10
1233414512
Output :

D
IN
G

1 occurs 3 times
2 occurs 2 times
3 occurs 2 times
4 occurs 2 times

4
...


PR

Write a program to accept three values in order of a, b and c and get the result
of the above equation
...
Problem Statement –

A function is there which tells how many dealerships there are and the total
number of cars in each dealership
...

Input
3
42
40
12

Capgemini Coding CheatSheet

WWW
...
IN

2
1:1 MOCK SESSION

1:1 MOCK SESSION

WWW
...
IN

1:1 MOCK SESSION

Output
20
16
8
There are total 3 dealerships
dealerships1 contains 4 cars and 2 bikes

dealerships3 contains 1 cars and 2 bikes

D
IN
G

dealerships2 contains 4 cars and 0 bikes

Total number of tyres in dealerships1  is (4 x 4) + (2 x 2) = 20
Total number of tyres in dealerships2 is (4 x 4) + (0 x 2) = 16

6
...
When she
provides a number to her daughter, she should tell the factors of that number
...
Write a class FindFactor
...


PR

If the input provided is negative, ignore the sign and provide the output
...


Sample Input 1:
54

Sample Output 1:
1, 2, 3, 6, 9, 18, 27, 54

7
...
The
mark should be between 0 to 100 ,if it goes beyond the range display “You

Capgemini Coding CheatSheet

WWW
...
IN

3
1:1 MOCK SESSION

1:1 MOCK SESSION

WWW
...
IN

1:1 MOCK SESSION

have entered invalid mark
...
Problem Statement

C
O

Maximum mark in 3 semester:89

IM
E

Mayuri buys “N” no of products from a shop
...
She wants to know the item that has
the minimum discount offer, so that she can avoid buying that and save
money
...
Note:
There can be more than one product with a minimum discount
...
PRIMCECODING
...
PRIMCECODING
...

So the discount on the shoe is the minimum
...
Problem Statement
You have write a function that accepts, a string which length is “len”, the

char* moveHash(char str[],int n);
example :Sample Test Case

Move#Hash#to#Front
Output:

IM
E

MoveHashtoFront

C
O

Input:

D
IN
G

string has some “#”, in it you have to move all the hashes to the front of the
string and return the whole string back and print it
...
Shraddha Kapoor’s professor suggested that she study hard and prepare
well for the lesson on seasons
...
So write the

PR

program to get the solution to the above task?
March to May – Spring Season
June to August – Summer Season
September to November – Autumn Season
December to February – Winter Season
Note: The entered month should be in the range of 1 to 12
...

Sample Input 1:
Enter month: 6

Capgemini Coding CheatSheet

WWW
...
IN

5
1:1 MOCK SESSION

1:1 MOCK SESSION

WWW
...
IN

1:1 MOCK SESSION

Sample Output 1:
Season: Summer

11
...


D
IN
G

Input:
8
UDDDUDUU

Output:

1

12
...

The example describes a single valley
...

Input:

Matrix A: [[1,1,1,1], [2,2,2,2], [3,3,3,3], [4,4,4,4]]

PR

Matrix B: [[1,1,1,1], [2,2,2,2], [3,3,3,3], [4,4,4,4]]

Output:

Matrices are identical

Explanation: The program checks each corresponding element in both
matrices for equality
...
Pythagorean Triplets:
Problem: Generate all Pythagorean triplets with values smaller than a given
limit
...
PRIMCECODING
...
PRIMCECODING
...


, where

a

,

b

,

D
IN
G

and

a² + b² = c²

14
...


C
O

Input:

Array: [1, 2, 3, 4, 5, 6, 7, 8, 9]
Target: 4

Output:

3

IM
E

Explanation: The function returns the index of the target value in the
array
...
String Rotation:

Problem: Determine if one string is a rotation of another
...


WWW
...
IN

7
1:1 MOCK SESSION

1:1 MOCK SESSION

WWW
...
IN

1:1 MOCK SESSION

16
...


Input:
Array: [1, 2, 4, 5, 6]

Output:

3

17
...


D
IN
G

Explanation: The missing number is

Problem: Write a function to reverse a singly linked list
...


IM
E

18
...

Input:

PR

String: "abcabcbb"

Output:

3

Explanation: The longest substring is

"abc"

, which has a length of 3
...
Find the Duplicates in an Array:
Problem: Find duplicates in a given array of integers
...
PRIMCECODING
...
PRIMCECODING
...


20
...

Input:
Number: 29

Output:

True

D
IN
G

Explanation: 29 is a prime number
...
Merge Two Sorted Arrays:

Problem: Merge two sorted arrays into a single sorted array
...
Rotate an Array:

k

steps to the right
...


23
...


Input:
String: "{[()]}"

Output:

Capgemini Coding CheatSheet

WWW
...
IN

9
1:1 MOCK SESSION

1:1 MOCK SESSION

WWW
...
IN

1:1 MOCK SESSION

True

Explanation: The string has balanced parentheses
...
Largest Sum Contiguous Subarray (Kadane’s Algorithm):
Problem: Find the maximum sum of a contiguous subarray
...
Find the Intersection of Two Arrays:

has the largest sum = 6
...


Array 1: [1, 2, 2, 1]
Array 2: [2, 2]

Output:

C
O

Input:

IM
E

[2]

Explanation: The common element between the arrays is

2


...
Check for Palindrome:

PR

Problem: Given a string, check if it is a palindrome
...


27
...

Input:

Capgemini Coding CheatSheet

WWW
...
IN

10
1:1 MOCK SESSION

1:1 MOCK SESSION

WWW
...
IN

1:1 MOCK SESSION

Matrix: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Output:
[[7, 4, 1], [8, 5, 2], [9, 6, 3]]

Explanation: The matrix is rotated 90 degrees clockwise
...
Find the Majority Element:
n

, find the majority element (appears more

Input:
Array: [2, 2, 1, 1, 1, 2, 2]

Output:
2
2

appears more than

n/2

C
O

Explanation: The number

D
IN
G

Problem: Given an array of size
than n/2 times)
...


29
...


IM
E

Input:

String: "swiss"

Output:

PR

w

Explanation: 'w' is the first character that does not repeat in the string
...
Merge Intervals:
Problem: Given a collection of intervals, merge all overlapping intervals
...
PRIMCECODING
...
PRIMCECODING
...
The others remain unchanged
...
PRIMCECODING
Title: Coding - Questions
Description: This is coding questions if you solve then your coding skill move into next level.