AP Lab-II Syllabus
AP Lab-II Syllabus
AP Lab-II Syllabus
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 Illustrating basic algorithmic challenges through programs, encompassing concepts such as
stacks, queues, linked lists, tree traversals, graph traversals, hashing, and the calculation of
shortest paths.
CO4 Analyze the appropriate approaches for specific problems and achieve all test cases.
CO5 Create an outcome-based mini-project or idea as a solution for society.
d. Syllabus
You are also given three integers src, dst, and k, return the cheapest price from
src to dst with at most k stops. If there is no such route, return -1.
Problem link- https://leetcode.com/problems/cheapest-flights-within-k-
stops/
4. Problem statement –In a warehouse, there is a row of barcodes, where the
ith barcode is barcodes[i].
Rearrange the barcodes so that no two adjacent barcodes are equal. You may
return any answer, and it is guaranteed an answer exists.
Problem link- https://leetcode.com/problems/distant-barcodes/
5. Problem statement – You are given an integer array height representing the
heights of buildings, some bricks, and some ladders.
You start your journey from building 0 and move to the next building by possibly
using bricks or ladders.
While moving from building i to building i+1 (0-indexed),
If the current building's height is greater than or equal to the next building's
height, you do not need a ladder or bricks.
If the current building's height is less than the next building's height, you can
either use one ladder or (h[i+1] - h[i]) bricks.
Return the furthest building index (0-indexed) you can reach if you use the given
ladders and bricks optimally.
Problem link-https://leetcode.com/problems/furthest-building-you-can-
reach/
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 prices[i] is the price
Programming of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy 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
Theory
h. Relationship between the Course Outcomes (COs) and Program Outcomes (POs)
g. CO-PO Mapping
Course
PO1 PO PO PSO PS
Outco PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9
0 11 12 1 O2
me
CO1 3 - - - - 2 - - - 1 - - 2 -
CO2 3 3 - 2 3 - - - - 2 - - - -
CO3 - 3 - 3 - - - - - - - - 2 -
CO4 - 3 - 2 3 - - - 2 - - 2 - -
CO5 - - 2 - - - - 1 - - 3 3 - -
PSO1
PSO2