0% found this document useful (0 votes)
17 views7 pages

Programming Challenge

The document outlines a coding assessment with various programming tasks, including a banana transport puzzle, anagram grouping, Sudoku validation, palindrome generation, and minimum window substring search. Additionally, it requires designing a database schema for a student club management system and answering specific SQL queries. The assessment emphasizes code readability, clear handwriting, and making assumptions when necessary.
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)
17 views7 pages

Programming Challenge

The document outlines a coding assessment with various programming tasks, including a banana transport puzzle, anagram grouping, Sudoku validation, palindrome generation, and minimum window substring search. Additionally, it requires designing a database schema for a student club management system and answering specific SQL queries. The assessment emphasizes code readability, clear handwriting, and making assumptions when necessary.
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

Name

Date
Roll Number

Coding Instructions:

• Handwriting: Ensure your handwriting is clear and legible.


• Code Readability: Write your code in a way that is easy to read and understand.
• Duration: 120 minutes
• Attempt Maximum Questions: Strive to attempt as many questions as possible
within the given time.
• Assumptions: If necessary, make clear and concise assumptions to solve the
problems.

Note:

• Be attentive to code quality and readability.


• If any assumptions are made, clearly mention them in your solutions.

Best of luck with your coding assessment!


Banana Transport Puzzle

A camel is tasked with transporting 3,000 bananas to a


destination 1,000 kilometers away.

Constraints:

1. The camel can carry up to 1,000 bananas at a time.

2. The camel consumes one banana per kilometer travelled.

3. The camel can make multiple trips between any two points to transport bananas.

Question:

What is the maximum number of bananas that can be transported to the destination, 1000
kilometers away?

Provide your calculations and reasoning.


Problem:
You are given an array of strings. Your task is to group the strings that are anagrams of each
other into separate lists. Two strings are considered anagrams if they contain the same
characters in the same frequencies, regardless of their order.

Write an algorithm to group the strings into their respective anagram groups.

Input:
An array of strings, e.g., ["eat", "tea", "tan", "ate", "nat", "bat"].

Output:
A list of groups where each group contains strings that are anagrams of each other.
For example, Output: [["eat", "tea", "ate"], ["tan", "nat"], ["bat"]].

Example:

Input: ["eat", "tea", "tan", "ate", "nat", "bat"]


Output: [["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]
You are given a partially filled 9x9 Sudoku board. Your task is to determine if the board is valid.
A Sudoku board is valid if:

1. Each row contains the digits 1-9 without repetition.


2. Each column contains the digits 1-9 without repetition.
3. Each of the 9 subgrids (3x3) contains the digits 1-9 without repetition.

Only the filled cells (non-"." cells) need to be validated. Empty cells (".") can be ignored.

Input:
A 9x9 grid, where each cell contains:

• A digit from '1' to '9'


• A dot (".") representing an empty cell.

Output:

• Return true if the board is valid according to the rules.


• Return false if the board violates any of the rules.

Example:

Input:
board = [
["5", "3", ".", ".", "7", ".", ".", ".", "."],
["6", ".", ".", "1", "9", "5", ".", ".", "."],
[".", "9", "8", ".", ".", ".", ".", "6", "."],
["8", ".", ".", ".", "6", ".", ".", ".", "3"],
["4", ".", ".", "8", ".", "3", ".", ".", "1"],
["7", ".", ".", ".", "2", ".", ".", ".", "6"],
[".", "6", ".", ".", ".", ".", "2", "8", "."],
[".", ".", ".", "4", "1", "9", ".", ".", "5"],
[".", ".", ".", ".", "8", ".", ".", "7", "9"]
]
Output: true
Write a program to print all 6-digit palindromes. A palindrome is a number that
reads the same forward and backward.
Given two strings s and t, return the minimum window in s which contains all the
characters in t.

Input:

s = "ADOBECODEBANC",

t = "ABC"

Output: "BANC"
You are hired to design a database for a university's student club management system. The
university has multiple clubs, each with a unique club name and a president. Students can
join one or more clubs, and every student has a unique student ID, name, and enrollment
year. Each club organizes multiple events, with details such as the event name, event date,
and club hosting the event.

Your task is to:

1. Design the database schema by identifying necessary tables, their attributes, and
relationships (primary key and foreign keys)

2. Make sure that the schema is in the 3NF.

3. Answer the following SQL queries once the schema is created.

SQL Queries:

1. List all students along with the clubs they are a part of.

o If a student is not part of any club, still include their name in the output.

2. Find the name of the club president and the number of events organized by
their club in the year 2024.

3. Retrieve the details of all events (event name, date, and club name) along with
the names of students who participated in them.

o Include events that no student attended.

You might also like