0% found this document useful (0 votes)
25 views16 pages

MCCP-1 Record

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views16 pages

MCCP-1 Record

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

SRI VASAVI ENGINEERING COLLEGE

PEDATADEPALLI, TADEPALLIGUDEM.

This is to certify that this is a bonafide record of Practical


Work done in Master in Coding and Competitive Programming-I by Mr.SURYA
RAHUL EEDA bearing Roll No. 21A81A0578 of CSE Branch of V Semester
during the academic year 2023 to 2024.

No. of Experiments Done: 20

Faculty In charge of the Laboratory Head of the Department


INDEX
S. Topic Problem Page no
No
1 Mathematic 1. Union of two arrays 1
al 2. Find the most frequent digit 1
3. Jumping Caterpillars 2
4. Partition a number into two divisible parts 2
5. Recamans sequence 3
2 Arrays 6. Java Arrays | Set 1 4
7. Find k-th missing 4
element 8.Left out 5
candies 9.Reorganize The 5
Array 6
10. Ruling Pair
3 Strings 11.A Special Keyboard 7
12. Merge two strings 7
13. Sort the fest 8
14.Valid 8
Expression 9
15.Wrong Ball
4 Primes 16. Count Primes in Range 1
17. Damon Prime 0
18. Sort the fest 1
19. Sum of primes 0
20. Twisted Prime Number 1
1
1
1
1
2
GEEKS FOR GEEKS PROFILE:

LEETCODE PROFILE:
MATHEMATICAL PROBLEMS
1. Union of two arrays
Given a natural number N, the task is to find the sum of the divisors of all the divisors of N.

2. Find the most frequent digit


Given a number N, find the most occurring digit in it. If two or more digits occur same number
of times, then return the highest of them. Input number is given as a string.
MATHEMATICAL PROBLEMS
1. Union of two arrays
Given a natural number N, the task is to find the sum of the divisors of all the divisors of N.

2. Find the most frequent digit


Given a number N, find the most occurring digit in it. If two or more digits occur same number of
times, then return the highest of them. Input number is given as a string.
3. Jumping Caterpillars
Given N leaves numbered from 1 to N . A caterpillar at leaf 1, jumps from leaf to leaf in
multiples of Aj (Aj, 2Aj, 3Aj).j is specific to the caterpillar. Whenever a caterpillar reaches a
leaf, it eats it a little bit. You must find out how many leaves, from 1 to N, are left uneaten
after all K caterpillars have reached the end. Each caterpillar has its own jump factor denoted
by Aj, and each caterpillar starts at leaf number 1.

4. Partition a number into two divisible parts


Given a number (as string) and two integers a and b, divide the string in two non-empty parts such
that the first part is divisible by a and the second part is divisible by b. In case multiple answers
exist, return the string such that the first non-empty part has minimum length.
5. Recamans sequence
You are given an integer N. You need to convert all zeroes of N to
Given an integer n. Print first n elements of Recaman’s sequence.
It is basically a function with domain and co-domain as natural numbers and 0. It is recursively
defined as below:
Specifically, let a(n) denote the (n+1)-th term. (0 being already there). The rule says:
a(0) = 0 a(n) = a(n-1) - n if a(n-1) - n > 0 and is not already present in the
sequence = a(n-1) + n otherwise.
PROBLEMS ON ARRAYS
1. Java Arrays | Set 1
For a given array of price of items, you have to calculate the average of all prices up to 2 decimal
places.
Note: Sum is printed automatically, you only need to calculate and return the average

2. Find k-th missing element


Given two sequences, one is increasing sequence a[] and another a normal sequence b[], find the
K-th missing element in the increasing sequence which is not present in the given sequence. If no
K-th missing element is there output -1
3. Left out candies
Given N students sitting in a circle, distribute M candies to these students. The ith student can take
only i candies. If Ith student does not get the required amount of candies he will not take it.
Distribute the candies starting from the 1st student and moving along the circle of students till you
reach a student you can not give candies to. You need to find the amount of candies left.

4. Reorganize The Array


Given an array of elements of length N, ranging from 0 to N-1, your task is to write a program that
rearranges the elements of the array. All elements may not be present in the array, if the element is
not present then there will be -1 present in the array. Rearrange the array such that A[i] = i and if it
is not present, display -1 at that place.
5. Ruling Pair
Geek Land has a population of N people and each person's ability to rule the town is measured by
a numeric value arr[i]. The two people that can together rule Geek Land must be compatible with
each other i.e., the sum of digits of their ability arr[i] must be equal. Their combined ability should
be maximum amongst all the possible pairs of people. Find the combined ability of the Ruling
Pair.
PROBLEMS ON STRINGS

1. A Special Keyboard
Imagine you have a special keyboard with all keys in a single row. The layout of characters on a
keyboard is denoted by a string S1 of length 26. S1 is indexed from 0 to 25. Initially, your finger is
atindex0.To type a character, you have to move your finger to the index of the desired character.
The time taken to move your finger from index i to index j is |j-i|, where || denotes absolute value.
Find the time taken to type the string S2 with the given keyboard layout.

2. Merge two strings


Given two strings S1 and S2 as input, the task is to merge them alternatively i.e. the first character of
S1 then the first character of S2 and so on till the strings end. NOTE: Add the whole string if other
string is empty.
3. Sort the fest
Given the menu of the two restaurants. There may be a chance of fight between them if any one of
them have any item in common and you surely don't want that to happen. Each of the menu has 5
items (strings) in them. So, your task is to find out if there is any need to change the menu or let
them be happy with their respective menu.

4. Valid Expression
Given a string S, composed of different combinations of '(' , ')', '{', '}', '[', ']'. The task is to verify the
validity of the arrangement. An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. 2. Open brackets must be closed in the correct order.
5. Wrong Ball
There is a table on which N balls are kept starting from index 1 to N in horizontal direction.
Each ball is either of red (denoted by 'R') or of blue (denoted by 'B') color. Any red ball which
is placed on even indices and blue balls placed on odd indices is considered as wrongly placed.
You need return the number of balls placed wrong on the table.
PROBLEMS ON PRIMES

1. Count Primes in Range


Given two numbers L and R(L<R). Count all the prime numbers in the range [L, R].

2. Damon Prime
Damon is a mathematician. He will give you an integer N, you need to find whether the number is
Damon Prime or not.
For example: 4 is a damon prime, 5 is not a damon prime, 102 is a damon prime, 9 is not a damon
prime, etc .
3. Primes sum
Given a number N. Find if it can be expressed as sum of two prime numbers.

4. Sum of primes
Your task is to calculate sum of primes present as digits of given number N.
5. Twisted Prime Number
Given a number N. Check whether N is a Twisted Prime number or not.
Note: A number is called Twisted Prime if it is a prime and its reverse is also a prime.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy