100% found this document useful (1 vote)
176 views3 pages

Python & SQL Coding Prep Guide

The document outlines a coding preparation guide for JMAN interviews focusing on Python and SQL. It includes practice questions categorized by topics such as strings, arrays, hash maps, sorting, and searching for Python, as well as SQL concepts like joins, aggregates, subqueries, and filtering. It also recommends using platforms like LeetCode, HackerRank, and SQLZoo for additional practice.

Uploaded by

kondetivineetha
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
100% found this document useful (1 vote)
176 views3 pages

Python & SQL Coding Prep Guide

The document outlines a coding preparation guide for JMAN interviews focusing on Python and SQL. It includes practice questions categorized by topics such as strings, arrays, hash maps, sorting, and searching for Python, as well as SQL concepts like joins, aggregates, subqueries, and filtering. It also recommends using platforms like LeetCode, HackerRank, and SQLZoo for additional practice.

Uploaded by

kondetivineetha
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

JMAN Interview Coding Preparation (Python + SQL)

Python DSA Practice Questions (Topic-Wise)

1. Strings

- Check if a string is a Pangram.

- Count frequency of characters in a string.

- Group anagrams together.

- Replace vowels in a string.

- Reverse a string without using built-in functions.

- Split words by even/odd length and print them.

2. Arrays / Lists

- Remove duplicate elements from a list.

- Remove elements that appear more than once.

- Merge intervals (like meeting room problems).

3. Hash Maps

- Group words by anagram (use dictionary as hash map).

- Frequency map of characters.

4. Sorting and Searching

- Custom sort strings.

- Sort based on length or frequency.

5. Patterns
JMAN Interview Coding Preparation (Python + SQL)

- Print pyramid, diamond, or hourglass using nested loops.

Practice each with Python using lists, dicts, sets, and string operations.

SQL Questions to Practice

1. Joins

- INNER JOIN to find matching data in two tables.

- LEFT JOIN to find unmatched records.

- Practice writing queries with multiple JOINs.

2. Aggregates & Group By

- Count, MAX, MIN, AVG, SUM by group.

- Total salary by department.

3. Subqueries

- Get 2nd or 3rd highest salary.

- Find employees earning above average salary.

4. Filtering & Sorting

- WHERE conditions with IN, BETWEEN, LIKE.

- ORDER BY salary DESC.

5. Common Questions
JMAN Interview Coding Preparation (Python + SQL)

- Top N per group (e.g. highest scorer per class).

- Find duplicates in a table.

- Fetch nth row using LIMIT/OFFSET.

Use practice platforms like LeetCode, HackerRank, SQLZoo.

Common questions

Powered by AI

To merge overlapping intervals, first sort the intervals based on their start times. Then, iterate through the sorted list, maintaining a current interval to compare against. If the current interval overlaps with the next interval in the list, merge them into a single interval. If it does not overlap, add the current interval to the list of merged intervals and update the current interval to the next interval. This approach efficiently combines overlapping intervals in linear time after sorting .

When sorting strings based on custom criteria, such as length or frequency, a stable sort algorithm is necessary to maintain the relative order of records that have equal keys. A stable sort ensures predictability when the sort criteria return multiple equivalent keys within different subsets of the list, preserving the sequence of the original unsorted list where possible .

A LEFT JOIN in SQL is used to return all records from the left table and the matched records from the right table. Records with no matching record in the right table are returned with NULL values. This can be used to find records unique to the left table by filtering for NULLs in the result set of the join. This is commonly applied to detect unmatched records across datasets or tables .

Subqueries can be used to calculate the average salary in a SQL database, which then serves as a condition in the WHERE clause of the main query. The subquery computes the average salary, and the main query selects employees whose salaries are greater than this average, thereby filtering out those who earn above-average wages in a single, efficient query process .

The BETWEEN clause in SQL is used to filter records for values within a specific range (inclusive of the endpoints) and is semantically clearer and potentially more efficient than using multiple OR conditions. Using BETWEEN can reduce query complexity and improve readability compared to OR since it integrates boundary conditions into a single, intuitive expression .

To find the third highest salary efficiently, use a subquery to create a ranked list of salaries ordered in descending order and limit the selection to skip the top two. Another approach is using the DISTINCT and ORDER BY clauses to sort salaries, setting a limit offset to fetch the third value. Alternatively, use the DENSE_RANK function to order distinct salary values and filter for the one with rank 3 .

To check if a string is a pangram without using built-in functions, iterate through each letter in the string. Use a boolean array of size 26 to represent the alphabet. As each letter is encountered, mark its corresponding index in the boolean array as true. After processing the string, check if all elements in the array are true, which would indicate that every letter of the alphabet appeared at least once .

To group anagrams using a hash map, iterate through each word, sort its characters, and use the sorted word as a key in the hash map. Append the original word to the list of words associated with this key. Once this process is completed for all words, the hash map will group all anagrams together by their character set .

Nested looping can print a pyramid pattern by using one loop to iterate through each level of the pyramid and another nested loop to manage the spacing and printing of characters. For each level, first print spaces to center the pyramid, then print increasing sequences of characters such as asterisks. Adjust the number of spaces and characters in each level according to the pyramid's level index .

LIMIT and OFFSET are crucial in SQL for pagination, allowing retrieval of specific rows from large datasets without loading entire results into memory. LIMIT defines the number of records to fetch, and OFFSET specifies where to start in the result set. However, excessive use can lead to performance issues as OFFSET has to iterate over a large number of rows to reach the starting point, and results can be inconsistent if the dataset changes between queries .

You might also like