Python interview questions in Programming — Part 1

chanduthedev
3 min readSep 21, 2023

--

Below are some of the programming questions I faced when I attended for senior python developer. You can find source code all these programs at GitHub.

  1. Given a string/word, Remove all pairs(2 consecutive same character) of characters which occur consecutively. And continue till no such pairs exist. (Asked in Altimetrik interview)
Removing pairs from a given string in python

You can find source code in the below GitHub link.

2. Check sub string letters present in the same order in the main string or not. (Altimetrik)

Find sub string letters in the same order in the main string in python
finding sub string letters in main string

3. Implement Fibonacci series using recursion and memoization(Crisil)

  • Memoization:
    -
    Is a concept of storing values and retrieved when required.
    - This will save lot of processing time and eliminates repeated operations.
    - This concept really helpful in recursive operations and avoid memory overflow exceptions.
  • I have implemented fibonacci series using memoization with and without inbuilt function functools.lru_cache.
  • Find the python implementation in the GitHub link

https://github.com/chanduthedev/python/blob/main/fibonacci_memoization.py

4. Rearrange list of integers in such way that all -ve numbers should come first and +ve numbers should come next. Numbers no need to be in sorted order.(Altemetrik)

5. Display round robin order string from given list of strings.(Foraysoft)

Python implementation to find round-robin string from a given list of strings

6. Implement logic to find a given string is become palindrome(Foraysoft)

Python implementation of finding a given string to become pallindrome or not

7. Given a string, find the most frequently occurring character, 2nd most frequently occurring character and print the corresponding counts(Foraysoft)

Python implementation for finding first two largest repeating key and its count.

8. Given a alphanumeric string, find list of integers and its unique count.(Quentelli)

9. How to find two given strings are anagrams or not?

Python Implementation to find given two words/sentences are anagrams to each other

All the source code for these programs can be found at GitHub. You can find more questions in Part2 article.

--

--