0% found this document useful (0 votes)
4 views

AP LAB-II SYLLABUS final.docx

The document outlines the course structure for 'Advance Programming Lab – II', detailing prerequisites, objectives, outcomes, and a comprehensive syllabus. It focuses on advanced programming techniques, algorithm application, and problem-solving skills through various programming tasks and data structures. The course includes practical exercises using languages like C++ and Java, covering topics such as data structures, full stack development, and algorithm design.

Uploaded by

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

AP LAB-II SYLLABUS final.docx

The document outlines the course structure for 'Advance Programming Lab – II', detailing prerequisites, objectives, outcomes, and a comprehensive syllabus. It focuses on advanced programming techniques, algorithm application, and problem-solving skills through various programming tasks and data structures. The course includes practical exercises using languages like C++ and Java, covering topics such as data structures, full stack development, and algorithm design.

Uploaded by

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

Course Code TITLE OF THE COURSE L T P S C CH Course Type*

Advance Programming Lab – II 0 0 4 0 2 2 EE

22CSP- Course Code(s)


351/22ITP- 22CSP-351/22ITP-
351 351
PRE- C++, JAVA, Data Structure
REQUISITE
CO- Data Structure and
REQUISITE Full Stack
Development
ANTI- -
REQUISITE

a. Course Description
Advance programming is the course in which students will learn how to apply algorithms in
order to solve complex problems. The goal of this course is to teach students how to apply
familiar algorithms to non-intuitive problems.

b. Course Objectives
● To give students the ability to write reliable codes.
● To provide skills to the students to write compact and efficient code in a quick manner
● To provide logic building capability to the student.
● To improve the logic building of students to tackle the complex problems.
● To implement the different approaches to get appropriate solutions.

c. Course Outcomes
CO1 Understand the problem and find out a better approach to solve a particular problem.
CO2 Apply the knowledge of the programming concept to develop small programs for
specific problems.
CO3 Analyze the appropriate approaches for specific problems and achieve all test cases.
CO4 Evaluate various solutions based on their efficiency, correctness, and resource utilization.
CO5 Design and implement algorithms or systems, ensuring their optimal functionality,
scalability, and maintainability.
d. Syllabus

Unit-1 Data Structures + MERN Contact Hours:15 CO

Full Stack 1. Problem Statement. Give understanding of Mongodb, CO1,


Development Nodejs, React, Express. CO2,
(MERN) 2. Problem Statement: Create a Frontend design of CO5
Login/Signup pages and create a backend of it.
3. Problem Statement: Test the Backend API via POSTMAN
and integrate it with React Frontend.
Arrays, 1. Problem statement - Given an array of integers nums and an CO2,
Stacks, integer target, return indices of the two numbers such that they add CO3
Queues up to target.
You may assume that each input would have exactly one solution,
and you may not use the same element twice.
You can return the answer in any order.
Problem link- https://leetcode.com/problems/two-sum/

2. Problem statement - You are given a 0-indexed array of


integers nums of length n. You are initially positioned at nums[0].
Each element nums[i] represents the maximum length of a
forward jump from index i. In other words, if you are at nums[i],
you can jump to any nums[i + j] where:
0 <= j <=
nums[i] and
i+j<n
Return the minimum number of jumps to reach nums[n - 1]. The
test cases are generated such that you can reach nums[n - 1].
Problem link- https://leetcode.com/problems/jump-game-ii/

3. Problem statement - Given a string path, which is an


absolute path (starting with a slash '/') to a file or directory in a
Unix-style file system, convert it to the simplified canonical path.
In a Unix-style file system, a period '.' refers to the current
directory, a double period '..' refers to the directory up a level, and
any multiple consecutive slashes (i.e. '//') are treated as a single
slash '/'. For this problem, any other format of periods such as '...'
are treated as file/directory names.
The canonical path should have the following format:
The path starts with a single slash '/'.
Any two directories are separated by a
single slash '/'. The path does not end with
a trailing '/'.
The path only contains the directories on the path from the root
directory to the target file or directory (i.e., no period '.' or double
period '..')
Return the simplified canonical path.
Problem link- https://leetcode.com/problems/simplify-path/
4. Problem statement - Implement a first in first out (FIFO)
queue using only two stacks. The implemented queue should
support all the functions of a normal queue (push, peek, pop, and
empty).
Implement the MyQueue class:
void push(int x) Pushes element x to the back of the queue.
int pop() Removes the element from the front of the queue and
returns it. int peek() Returns the element at the front of the
queue.
boolean empty() Returns true if the queue is empty, false otherwise.
Problem link-
https://leetcode.com/problems/implement-queue-using- stacks/

Linked 1. Problem statement - You are given the heads of two sorted CO1,
List, linked lists list1 and list2.Merge the two lists into one sorted CO3,
Operating list. The list should be made by splicing together the nodes of CO2
System the first two lists. Return the head of the merged linked list.
based Problem link-
question https://leetcode.com/problems/merge-two-sorted-lists/

2. Problem statement - Given the head of a sorted linked list,


delete all nodes that have duplicate numbers, leaving only
distinct numbers from the original list. Return the linked list
sorted as well.
Problem link-
https://leetcode.com/problems/remove-duplicates-from-
sorted-list-ii/

3. Problem Statement: LRU Cache


Design a data structure that follows the constraints of a Least
Recently Used (LRU) cache.

Implement the LRUCache class:

● LRUCache(int capacity) Initialize the LRU cache with


positive size capacity.
● int get(int key) Return the value of the key if the key exists,
otherwise return -1.
● void put(int key, int value) Update the value of the key if
the key exists. Otherwise, add the key-value pair to the
cache. If the number of keys exceeds the capacity from this
operation, evict the least recently used key.
The functions get and put must each run in O(1) average time
complexity.
Problem Link - https://leetcode.com/problems/lru-cache/

4. Problem Statement: LFU Cache


Design and implement a data structure for a Least Frequently
Used (LFU) cache.

Implement the LFUCache class:

● LFUCache(int capacity) Initializes the object with the


capacity of the data structure.
● int get(int key) Gets the value of the key if the key exists
in the cache. Otherwise, returns -1.
● void put(int key, int value) Update the value of the key if
present, or inserts the key if not already present. When the cache
reaches its capacity, it should invalidate and remove the least
frequently used key before inserting a new item. For this
problem, when there is a tie (i.e., two or more keys with the same
frequency), the least recently used key would be invalidated.
● To determine the least frequently used key, a use counter
is maintained for each key in the cache. The key with the smallest
use counter is the least frequently used key.

When a key is first inserted into the cache, its use counter is set to
1 (due to the put operation). The use counter for a key in the
cache is incremented; either a get or put operation is called on it.
The functions get and put must each run in O(1) average time
complexity.
Problem link - https://leetcode.com/problems/lfu-cache/

5. Problem Statement: All O`one Data Structure


Design a data structure to store the strings' count with the ability to
return the strings with minimum and maximum counts.

Implement the AllOne class:

● AllOne() Initializes the object of the data structure.


● inc(String key) Increments the count of the string key by 1.
If key does not exist in the data structure, insert it with
count 1.
● dec(String key) Decrements the count of the string key by
1. If the count of key is 0 after the decrement, remove it
from the data structure. It is guaranteed that key exists in
the data structure before the decrement.
● getMaxKey() Returns one of the keys with the maximal
count. If no element exists, return an empty string "".
● getMinKey() Returns one of the keys with the minimum
count. If no element exists, return an empty string "".
Note that each function must run in O(1) average time complexity.
Problem link -
https://leetcode.com/problems/all-oone-data-structure/

6. Problem Statement: Single-Threaded CPU


You are given n​​ tasks labeled from 0 to n - 1 represented by a 2D
integer array tasks, where tasks[i] = [enqueueTimei,
processingTimei] means that the i​​th​​ task will be available to
process at enqueueTimei and will take processingTimei to finish
processing.

You have a single-threaded CPU that can process at most one


task at a time and will act in the following way:

● If the CPU is idle and there are no available tasks to


process, the CPU remains idle.
● If the CPU is idle and there are available tasks, the CPU
will choose the one with the shortest processing time. If multiple
tasks have the same shortest processing time, it will choose the
task with the smallest index.
● Once a task is started, the CPU will process the entire task
without stopping.
● The CPU can finish a task then start a new one instantly.
Return the order in which the CPU will process the tasks.
Problem Link -
https://leetcode.com/problems/single-threaded-cpu/
String 1. Problem statement - Given two strings s and goal, return true CO2,
Matching, if and only if s can become goal after some number of shifts on s. CO3
Hashing, Heap A shift on s consists of moving the leftmost character of s to the
rightmost position.
For example, if s = "abcde", then it will be "bcdea" after one shift.
Problem link- https://leetcode.com/problems/rotate-string/
2. Problem statement - Given two strings needle and
haystack, return the index of the first occurrence of needle in
haystack, or -1 if needle is not part of haystack.
Problem
link-https://leetcode.com/problems/find-the-index-of-the-first-
occurrence-in-a-string/
3. Problem statement - Given an array of strings queries
and a string pattern, return a boolean array answer where
answer[i] is true if queries[i] matches pattern, and false otherwise.
A query word queries[i] matches pattern if you can insert
lowercase English letters pattern so that it equals the query. You
may insert each character at any position and you may not insert
any characters.
Problem link- https://leetcode.com/problems/camelcase-matching/
4. Problem statement - Given two strings a and b, return the
minimum number of times you should repeat string a so that
string b is a substring of it. If it is impossible for b to be a
substring of a after repeating it, return -1.
Notice: string "abc" repeated 0 times is "", repeated 1 time is
"abc" and repeated 2 times is "abcabc".
Problem link-
https://leetcode.com/problems/repeated-string-match/
5. Problem statement - A string is called a happy prefix if is
a non-empty prefix which is also a suffix (excluding itself).
Given a string s, return the longest happy prefix of s. Return an
empty string "" if no such prefix exists.
Problem link- https://leetcode.com/problems/longest-happy-prefix/
6. Problem statement – Given an array nums containing n
distinct numbers in the range [0, n], return the only number in the
range that is missing from the array.
Problem link- https://leetcode.com/problems/missing-number/

7. Problem statement – Given a pattern and a string s, find if s


follows the same pattern.Here follow means a full match, such
that there is a bijection between a letter in pattern and a
non-empty word in s.
Input: pattern = "abba", s = "dog
cat cat dog" Output: true
Problem link - https://leetcode.com/problems/word-pattern/

8. Problem statement – Given a string s, find the length of the


longest
Substring without repeating characters.
Example 1:
Input: s = "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Problem link -
https://leetcode.com/problems/longest-substring-without-repeatin
g-characters/

9. Problem statement – Given a string s, find the length


of the longest Substring without repeating characters.
Input: s =
"abcabcbb"
Output: 3
Problem link -
https://leetcode.com/problems/longest-duplicate-substring/

10. Problem statement – You are given a string s. You can convert
s to a Palindrome by adding characters in front of it.
Return the shortest palindrome you can find by performing this
transformation.
Input: s =
"aacecaaa"
Output:
"aaacecaaa
"
Problem link - https://leetcode.com/problems/shortest-palindrome/

11. Problem Statement: Task Scheduler


You are given an array of CPU tasks, each labeled with a letter
from A to Z, and a number n. Each CPU interval can be idle or
allow the completion of one task. Tasks can be completed in any
order, but there's a constraint: there has to be a gap of at least n
intervals between two tasks with the same label.

Return the minimum number of CPU intervals required to


complete all tasks.
Problem link - https://leetcode.com/problems/task-scheduler/

12. Problem Statement: Task Scheduler II


You are given a 0-indexed array of positive integers tasks,
representing tasks that need to be completed in order, where
tasks[i] represents the type of the ith task.

You are also given a positive integer space, which represents the
minimum number of days that must pass after the completion of a
task before another task of the same type can be performed.

Each day, until all tasks have been completed, you must either:

● Complete the next task from tasks, or


● Take a break.
Return the minimum number of days needed to complete all tasks.
Problem link - https://leetcode.com/problems/task-scheduler-ii/

Unit-2 Advance Data Structures Contact Hours:15 CO

Tree 1. Problem statement- Given the roots of two binary trees p CO3
and q, write a function to check if they are the same or not.Two
binary trees are considered the same if they are structurally
identical, and the nodes have the same value. Problem link-
https://leetcode.com/problems/same-tree/
2. Problem statement- Given the root of a binary tree,
check whether it is a mirror of itself (i.e., symmetric around its
center).
Problem link- https://leetcode.com/problems/symmetric-tree/
3. Problem statement- Given a binary tree,
determine if it is height-balanced.
Problem link- https://leetcode.com/problems/balanced-binary-tree/
4. Problem statement- Given the root of a binary tree and
an integer targetSum, return true if the tree has a root-to-leaf path
such that adding up all the values along the path equals
targetSum.
A leaf is a node with no children.
Problem link- https://leetcode.com/problems/path-sum/
5. Problem statement- Given the root of a complete binary
tree, return the number of the nodes in the tree. According to
Wikipedia, every level, except possibly the last, is completely
filled in a complete binary tree, and all nodes in the last level are
as far left as possible. It can have between 1 and 2h nodes
inclusive at the last level h. Design an algorithm that runs in less
than O(n) time complexity.
Problem link-
https://leetcode.com/problems/count-complete-tree-nodes/
6. Problem statement- Given a root node reference of a
BST and a key, delete the node with the given key in the BST.
Return the root node reference (possibly updated) of the BST.
Basically, the deletion can be divided into two stages: Search for a
node to remove.
If the node is found, delete the node.
Problem link- https://leetcode.com/problems/delete-node-in-a-bst/

7. Problem statement- Given the root of a binary tree,


return the length of the diameter of the tree.
The diameter of a binary tree is the length of the longest path
between any two nodes in a tree. This path may or may not pass
through the root.
The length of a path between two nodes is represented by the
number of edges between them.
Problem link-
https://leetcode.com/problems/diameter-of-binary-tree/

Graph + 1. Problem statement- There is an undirected graph with n CO3


Computer nodes, where each node is numbered between 0 and n - 1. You are
Network given a 2D array graph, where graph[u] is an array of nodes that
Question node u is adjacent to. More formally, for each v in graph[u], there
is an undirected edge between node u and node v. The graph has
the following properties:
There are no self-edges (graph[u] does not contain u).
There are no parallel edges (graph[u] does not contain
duplicate values). If v is in graph[u], then u is in graph[v]
(the graph is undirected).
The graph may not be connected, meaning there may be two nodes
u and v such that there is no path between them.
A graph is bipartite if the nodes can be partitioned into two
independent sets A and B such that every edge in the graph
connects a node in set A and a node in set B.
Return true if and only if it is bipartite.
Problem link- https://leetcode.com/problems/is-graph-bipartite/
2. Problem statement- An n-bit gray code sequence is a
sequence of 2n integers where:Every integer is in the inclusive
range [0, 2n - 1],
The first integer is 0,
An integer appears no more than once in the sequence,
The binary representation of every pair of adjacent integers differs
by exactly one bit, and
The binary representation of the first and last integers differs by
exactly one bit. Given an integer n, return any valid n-bit gray code
sequence.
Problem link- https://leetcode.com/problems/gray-code/
3. Problem statement- There are n people that are split into
some unknown number of groups. Each person is labeled with a
unique ID from 0 to n - 1.
You are given an integer array groupSizes, where groupSizes[i] is
the size of the group that person i is in. For example, if
groupSizes[1] = 3, then person 1 must be in a group of size 3.
Return a list of groups such that each person i is in a group of size
groupSizes[i]. Each person should appear in exactly one group,
and every person must be in a group. If there are multiple answers,
return any of them. It is guaranteed that there will be at least one
valid solution for the given input.
Problem link-
https://leetcode.com/problems/group-the-people-given-the-
group-size-they-belong-to/
4. Problem statement- A city's skyline is the outer contour
of the silhouette formed by all the buildings in that city when
viewed from a distance. Given the locations and heights of all the
buildings, return the skyline formed by these buildings
collectively.The geometric information of each building is given
in the array buildings where buildings[i] = [lefti, righti, heighti]:
lefti is the x coordinate of the left edge of the ith
building. righti is the x coordinate of the right edge
of the ith building. heighti is the height of the ith
building.
You may assume all buildings are perfect rectangles grounded on an
absolutely flat surface at height 0.
The skyline should be represented as a list of "key points" sorted
by their x- coordinate in the form [[x1,y1],[x2,y2],...]. Each key
point is the left endpoint of some horizontal segment in the skyline
except the last point in the list, which
always has a y-coordinate 0 and is used to mark the skyline's
termination where the rightmost building ends. Any ground between
the leftmost and rightmost buildings should be part of the skyline's
contour.
Problem link- https://leetcode.com/problems/the-skyline-problem/
5. Problem statement- You are given two strings s and t.
String t is generated by random shuffling string s and then add one
more letter at a random position.
Return the letter that was added to t.
Problem link- https://leetcode.com/problems/find-the-difference/
6. Problem statement- You are given an integer array nums.
Two players are playing a game with this array: player 1 and
player 2.
Player 1 and player 2 take turns, with player 1 starting first. Both
players start the game with a score of 0. At each turn, the player
takes one of the numbers from either end of the array (i.e.,
nums[0] or nums[nums.length - 1]) which reduces the size of the
array by 1. The player adds the chosen number to their score. The
game ends when there are no more elements in the array.
Return true if Player 1 can win the game. If the scores of both
players are equal, then player 1 is still the winner, and you should
also return true. You may assume that both players are playing
optimally.
Problem link- https://leetcode.com/problems/predict-the-winner/
7. Problem Statement: Number of Operations to Make Network
Connected

There are n computers numbered from 0 to n - 1 connected by


ethernet cables connections forming a network where
connections[i] = [ai, bi] represents a connection between computers
ai and bi. Any computer can reach any other computer directly or
indirectly through the network.

You are given an initial computer network connections. You can


extract certain cables between two directly connected computers,
and place them between any pair of disconnected computers to
make them directly connected.

Return the minimum number of times you need to do this in order


to make all the computers connected. If it is not possible, return -1.
Problem Link -
https://leetcode.com/problems/number-of-operations-to-make-netw
ork-connected/
8. Problem Statement: Critical Connections in a Network
There are n servers numbered from 0 to n - 1 connected by
undirected server-to-server connections forming a network where
connections[i] = [ai, bi] represents a connection between servers ai
and bi. Any server can reach other servers directly or indirectly
through the network.
A critical connection is a connection that, if removed, will make
some servers unable to reach some other server.
Return all critical connections in the network in any order.
Problem Link -
https://leetcode.com/problems/critical-connections-in-a-network/

Divide and 1. Problem statement- The count-and-say sequence is a sequence CO4


Conquer of digit strings defined by the recursive formula:
countAndSay(1) = "1"
countAndSay(n) is the way you would "say" the digit string from
countAndSay(n-1), which is then converted into a different digit
string.
To determine how you "say" a digit string, split it into the minimal
number of substrings such that each substring contains exactly one
unique digit. Then for each substring, say the number of digits,
then say the digit. Finally, concatenate every said digit.
Problem link- https://leetcode.com/problems/count-and-say/
3. Problem statement- We have two
special characters: The first character can be
represented by one bit 0.
The second character can be represented by two bits (10 or 11).
Given a binary array bit that ends with 0, return true if the last
character must be a one-bit character.
Problem link-
https://leetcode.com/problems/1-bit-and-2-bit-characters/
4. Problem statement- You're given strings jewels
representing the types of stones that are jewels, and stones
representing the stones you have. Each character in stones is a
type of stone you have. You want to know how many of the stones
you have are also jewels.
Letters are case sensitive, so "a" is considered a different type of
stone from "A".
Problem link- https://leetcode.com/problems/jewels-and-stones/
5. Problem statement- You are given an n x n integer matrix
board where the cells are labeled from 1 to n2 in a Boustrophedon
style starting from the bottom left of the board (i.e. board[n -
1][0]) and alternating direction each row.
You start on square 1 of the board. In each move, starting from
square curr, do the following:
Choose a destination square next with a label in the range [curr +
1, min(curr + 6, n2)].
This choice simulates the result of a standard 6-sided die roll: i.e.,
there are always at most 6 destinations, regardless of the size of
the board.
If next has a snake or ladder, you must move to the destination of
that snake or ladder. Otherwise, you move to next.
The game ends when you reach the square n2.
A board square on row r and column c has a snake or ladder if
board[r][c] != -1. The destination of that snake or ladder is
board[r][c]. Squares 1 and n2 do not have a snake or ladder.
Note that you only take a snake or ladder at most once per move.
If the destination to a snake or ladder is the start of another snake
or ladder, you do not follow the subsequent snake or ladder.
Problem link- https://leetcode.com/problems/snakes-and-ladders/
6. Problem statement- You are given two jugs with
capacities jug1Capacity and jug2Capacity liters. There is an
infinite amount of water supply available. Determine whether it is
possible to measure exactly targetCapacity liters using these two
jugs.
If targetCapacity liters of water are measurable, you must have
targetCapacity liters of water contained within one or both buckets
by the end.
Operations allowed:
Fill any of the jugs
with water. Empty
any of the jugs.
Pour water from one jug into another till the other jug is completely
full, or the first jug itself is empty.
Problem link-
https://leetcode.com/problems/water-and-jug-problem/
7. Problem statement- You are given a 0-indexed string s
that you must perform k replacement operations on. The
replacement operations are given as three 0- indexed parallel
arrays, indices, sources, and targets, all of length k.
To complete the ith replacement operation:
Check if the substring sources[i] occurs at index indices[i] in the
original string s.If it does not occur, do nothing.
Otherwise, if it does occur, replace that substring with targets[i].
Problem link-
https://leetcode.com/problems/find-and-replace-in-string/

Unit-3 Advance Data Structures Contact Hours:15 CO

Greedy 1. Problem statement- There are n children standing in a CO3,


line. Each child is assigned a rating value given in the integer CO4
array ratings.
You are giving candies to these children subjected to the following
requirements:
Each child must have at least one candy.
Children with a higher rating get more candies than their
neighbors.
Return the minimum number of candies you need to have to
distribute the candies to the children.
Problem link- https://leetcode.com/problems/candy/
2. Problem statement- You are given an integer array prices
where prices[i] is the price of a given stock on the ith day.
On each day, you may decide to buy and/or sell the stock. You can
only hold at most one share of the stock at any time. However, you
can buy it then immediately sell it on the same day.
Find and return the maximum profit you can achieve.
Problem link-
https://leetcode.com/problems/best-time-to-buy-and-sell-
stock-ii/
3. Problem statement- Given a string s, remove duplicate
letters so that every letter appears once and only once. You must
make sure your result is the smallest in lexicographical order
among all possible results.
Input: s = "bcabc"
Output: "abc"
Problem link-
https://leetcode.com/problems/remove-duplicate-letters/
4. Problem statement- You have a long flowerbed in which
some of the plots are planted, and some are not. However,
flowers cannot be planted in adjacent plots.
Given an integer array flowerbed containing 0's and 1's, where 0
means empty and 1 means not empty, and an integer n, return
true if n new flowers can be planted in the flowerbed without
violating the no-adjacent-flowers rule and false otherwise.
Problem link- https://leetcode.com/problems/can-place-flowers/
5. Problem statement- Assume you are an awesome parent
and want to give your children some cookies. But you should
give each child at most one cookie. Each child i has a greed
factor g[i], which is the minimum size of a cookie that the child
will be content with; and each cookie j has a size s[j]. If s[j] >=
g[i], we can assign the cookie j to the child i, and the child i will
be content. Your goal is to maximize the number of your content
children and output the maximum number.
Problem link- https://leetcode.com/problems/assign-cookies/
6. Problem statement- You are given an array arr which
consists of only zeros and ones, divide the array into three
non-empty parts such that all of these parts represent the same
binary value.If it is possible, return any [i, j] with i + 1
< j, such that: arr[0], arr[1], ..., arr[i] is the
first part, arr[i + 1], arr[i + 2], ..., arr[j - 1]
is the second part, and arr[j], arr[j + 1], ...,
arr[arr.length - 1] is the third part. All
three parts have equal binary values.
If it is not possible, return [-1, -1].
Note that the entire part is used when considering what binary
value it represents. For example, [1,1,0] represents 6 in decimal,
not 3. Also, leading zeros are allowed, so [0,1,1] and [1,1]
represent the same value.
Problem link- https://leetcode.com/problems/three-equal-parts/

Backtracking 1. Problem statement- A binary watch has 4 LEDs on the CO3,


top to represent the hours (0-11), and 6 LEDs on the bottom to CO5
represent the minutes (0-59). Each LED represents a zero or one,
with the least significant bit on the right.
For example, the below binary watch reads "4:51". Given an
integer turnedOn which represents the number of LEDs that are
currently on (ignoring the PM), return all possible times the
watch could represent. You may return the answer in any order.
The hour must not contain a leading zero.
For example, "01:00" is not valid. It should be "1:00".
The minute must consist of two digits and may contain a
leading zero. For example, "10:2" is not valid. It should
be "10:02".
Problem link- https://leetcode.com/problems/binary-watch/
2. Problem statement- We are given n different types of
stickers. Each sticker has a lowercase English word on it. You
would like to spell out the given string target by cutting
individual letters from your collection of stickers and rearranging
them. You can use each sticker more than once if you want, and
you have infinite quantities of each sticker.
Return the minimum number of stickers that you need to spell
out target. If the task is impossible, return -1.

Note: In all test cases, all words were chosen randomly from the
1000 most common US English words, and target was chosen as
a concatenation of two random words.
Problem link-
https://leetcode.com/problems/stickers-to-spell-word/
3. Problem statement- Given a directed acyclic graph
(DAG) of n nodes labeled from 0 to n - 1, find all possible paths
from node 0 to node n - 1 and return them in any order.
The graph is given as follows: graph[i] is a list of all nodes you
can visit from node i (i.e., there is a directed edge from node i to
node graph[i][j]).
Problem link-
https://leetcode.com/problems/all-paths-from-source-to- target/
4. Problem statement- A transformation sequence from
word beginWord to word endWord using a dictionary wordList is
a sequence of words beginWord -
> s1 -> s2 -> ... -> sk such that:
Every adjacent pair of words differs by a single letter.
Every si for 1 <= i <= k is in wordList. Note that beginWord
does not need to be in wordList.
sk == endWord
Given two words, beginWord and endWord, and a dictionary
wordList, return all the shortest transformation sequences from
beginWord to endWord, or an empty list if no such sequence
exists. Each sequence should be returned as a list of the words
[beginWord, s1, s2, ..., sk].
Problem link- https://leetcode.com/problems/word-ladder-ii/
5. Problem statement- Given an integer array nums of
unique elements, return all possible subsets (the power set).
The solution set must not contain duplicate subsets. Return the
solution in any order.
Input: nums = [1,2,3]
Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
Problem link- https://leetcode.com/problems/subsets/
6. Problem statement- Given two integers n and k, return
all possible combinations of k numbers chosen from the range [1,
n].
You may return the answer in
any order. Input: n = 4, k = 2
Output: [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
Problem link- https://leetcode.com/problems/combinations/
Dynamic 1. Problem statement- You are given an array prices where CO3,
Programmi prices[i] is the price of a given stock on the ith day. CO4,
ng You want to maximize your profit by choosing a single day to buy CO5
one stock and choosing a different day in the future to sell that
stock.
Return the maximum profit you can achieve from this transaction.
If you cannot achieve any profit, return 0.
Problem link-
https://leetcode.com/problems/best-time-to-buy-and-sell- stock/
2. Problem statement- A message containing letters from
A-Z can be encoded into numbers using the following mapping:
'A' -> "1"
'B' -> "2"
...
'Z' -> "26"
To decode an encoded message, all the digits must be grouped
then mapped back into letters using the reverse of the mapping
above (there may be multiple ways). For example, "11106" can
be mapped into:
"AAJF" with the grouping (1 1 10 6)
"KJF" with the grouping (11 10 6)
Note that the grouping (1 11 06) is invalid because "06" cannot
be mapped into 'F' since "6" is different from "06".
Given a string s containing only digits, return the number of
ways to decode it. The test cases are generated so that the
answer fits in a 32-bit integer.
Problem link- https://leetcode.com/problems/decode-ways/
3. Problem statement- We can scramble a string s to get a
string t using the following algorithm:
If the length of the string is 1, stop.
If the length of the string is > 1, do the following:
Split the string into two non-empty substrings at a random index,
i.e., if the string is s, divide it to x and y where s = x + y.
Randomly decide to swap the two substrings or to keep them in the
same order. i.e., after this step, s may become s = x + y or s = y + x.
Apply step 1 recursively on each of the two substrings x and y.
Given two strings s1 and s2 of the same length, return true if s2 is a
scrambled string of s1, otherwise, return false.
Problem link- https://leetcode.com/problems/scramble-string/
4. Problem statement- You are climbing a staircase. It
takes n steps to reach the top. Each time you can either climb 1
or 2 steps. In how many distinct ways can you climb to the top?
Problem link- https://leetcode.com/problems/climbing-stairs/
5. Problem statement- Given an integer array
nums, find the subarray with the largest sum, and return
its sum.
Input: nums = [-2,1,-3,4,-1,2,1,-5,4]
Output: 6
Problem link- https://leetcode.com/problems/maximum-subarray/
6. Problem statement- Given a string s, return the longest
Palindromic substring in s.
Input: s
=
"babad"
Output:
"bab"
Problem link-
https://leetcode.com/problems/longest-palindromic- substring/
7. Problem statement- You are a professional robber planning to
rob houses along a street. Each house has a certain amount of
money stashed. All houses at this place are arranged in a circle.
That means the first house is the neighbor of the last one.
Meanwhile, adjacent houses have a security system connected,
and it will automatically contact the police if two adjacent houses
were broken into on the same night.
Given an integer array nums representing the amount of money
of each house, return the maximum amount of money you can
rob tonight without alerting the police.
Problem link- https://leetcode.com/problems/house-robber-ii/

e. References
1. “Introduction to Algorithms” by Thomas H. Cormen,
Charles E. Leiserson,Ronald L.Rivest, and Clifford
Stein.
2. Algorithms Unlocked” by Thomas H. Cormen
3. “Data Structures and Algorithms Made Easy:
Data Structures and AlgorithmicPuzzles”by
Narasimha Karumanchi.
4. “Grokking Algorithms: An illustrated guide
for programmers and othercurious people”by
Aditya Bhargava

f. Assessment Pattern -Internal and External

The performance of students is evaluated as follows:

Theory

Components Continuous Semester End Examination


Internal (SEE)
Assessment (CAE)
Marks 60 40

Total Marks 100


g. Internal Evaluation Component

Sr. Type of Weightage of actual Frequency Final Weightage Remarks


No. Assessment conduct of Task in Internal
Assessment
1 Conduct 12 Marks 1 per practical 60 Marks per
per Practical course
2 Report 8 Marks 1 per practical
per Practical
3. Viva- Voce 10 Marks per Course 1 per Course
h. Relationship between the Course Outcomes (COs) and Program Outcomes (POs)

SN Course Outcome (CO) Mapped Programme Outcome (PO)


1 CO1 PO1, PO2, PO3, PO4, PO5, PO9, PO10, PO12, PSO1
2 CO2 PO1, PO2, PO3, PO4, PO5,PO9, PSO1, PSO2
3 CO3 PO1, PO2, PO3, PO4, PO5,PO9,PSO1
4 CO4 PO2, PO4, PO5, PO10, PO11, PSO1
5 CO5 PO2, PO3, PO4, PO5, PO8, PO9, PO10, PO11, PO12, PSO2

i. CO-PO Mapping

Course
Outcome PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO1 3 3 3 3 3 - - - 2 1 - 2 2 -
CO2 3 3 2 2 3 - - - 2 - - - 2 3
CO3 3 3 1 3 2 - - - 2 - - - 2 -
CO4 - 3 - 2 3 - - - - 2 2 - 1 -
CO5 - 2 3 2 3 - - 2 3 3 2 1 - 2
Average 3 2.8 2.25 2.4 2.8 - - 2 2.25 2 2 1.5 1.75 2.5

Course Course Name PO1 PO3 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
Code
22CSP- Advance
351/22ITP- Programming
351 Lab – II
3 2.8 2.25 2.4 2.8 - - 2 2.25 2 2 1.5 1.75 2.5

You might also like