# 10 Important Paytm Coding Interview Questions

If you are in a rush to crack that Paytm coding Interview Questions round then here is a short pocketbook that you should go through. Make sure you practice all the 10 coding questions in here, (and study the related ones) because these are the most asked Paytm coding interview questions, say the interviewees!

## Top 10 Paytm Coding Interview Questions

Coding comes in handy when you practise it several times. And one coding question can solve multiple related queries on the go. So do practise as many coding questions as you can!

### 1. Given an integer number, convert it to a roman numeral.

Answer: A combination of some symbols represent Roman numerals.

Sample Input:

num: 10

Expected output:

“X”

#### Code: IntegerToRoman.java

public class IntegerToRoman

{

//method to convert integer to roman

//function that converts an integer to roman

public static String intToRoman(int number)

{

//creating an array of place values

String[] thousands = {“”, “M”, “MM”, “MMM”};

String[] hundreds = {“”, “C”, “CC”, “CCC”, “CD”, “D”, “DC”, “DCC”, “DCCC”, “CM”};

String[] tens = {“”, “X”, “XX”, “XXX”, “XL”, “L”, “LX”, “LXX”, “LXXX”, “XC”};

String[] units = {“”, “I”, “II”, “III”, “IV”, “V”, “VI”, “VII”, “VIII”, “IX”};

return thousands[number / 1000] + hundreds[(number % 1000) / 100] + tens[(number % 100) / 10] + units[number % 10];

}

public static void main(String args[])

{

//creating an array of integers to be converted into roman

int[] numbers = {13, 21, 38, 50, 190, 141, 117, 120, 125, 138, 149, 6, 712, 181, 197, 918, 199, 1100, 1101, 1248, 1253};

for (int number: numbers)

{

System.out.printf(“%4d -> %8s\n”, number, intToRoman(number));

}

}

}

Output:

### 2. Given a string s, reverse the order of words.

Sample Input

``````life is beautiful
enjoy it
live upto it``````

Expected Output

``````beautiful is life
it enjoy
it upto live``````

#### Code:

``````class Solution {
String reverseWords(String s) {
int numOfWords = 1;
for (int i = 0; i < s.length(); i++) {
if(s.charAt(i) == ' ') {
numOfWords++;
}
}
String[] allWords = new  String[numOfWords];
String currentWord = "";
int index = 0;
for(int i = 0; i < s.length(); i++) {
if(s.charAt(i) == ' ') {
allWords[index++] = currentWord;
currentWord = "";
} else {
currentWord += s.charAt(i);
}
}
allWords[index++] = currentWord;
String ans = "";
for(int i = index - 1; i > 0; i--) {
ans += allWords[i];
ans += ' ';
}
ans += allWords[0];
return ans;
}
}``````

### 3. Sort an array of 0s, 1s and 2s

Sample Input:

{0, 1, 2, 0, 1, 2}

Output:

{0, 0, 1, 1, 2, 2}

#### Code:

`import java.io.*;`

`classcountzot{`

`    ``// Sort the input array, the array is assumed to`

`    ``// have values in {0, 1, 2}`

`    static void sort 012(inta[], intarr_size){`

`        ``int``lo = ``0``;`

`        ``int``hi = arr_size - ``1``;`

`        ``int``mid = ``0``, temp = ``0``;`

`        // Iterate till all the elements` `are sorted`

`        ``while``(mid <= hi) {`

`            ``switch``(a[mid]) {`

`                ``// If the element is 0`

`            ``case``0``: {`

`                ``temp = a[lo];`

`                ``a[lo] = a[mid];`

`                ``a[mid] = temp;`

`                ``lo++;`

`                ``mid++;`

`                ``break``;`

`            ``}`

`                ``// If the element is 1`

`            ``case``1``:`

`                ``mid++;`

`                ``break``;`

`                ``// If the element is 2`

`            ``case``2``: {`

`                ``temp = a[mid];`

`                ``a[mid] = a[hi];`

`                ``a[hi] = temp;`

`                ``hi--;`

`                ``break``;`

`            ``}`

`            ``}`

`        ``}`

`    ``}`

`    ``/* Utility function to print array arr[] */`

`    static void print Array(intarr[], intarr_size){`

`        ``int``i;`

`        ``for``(i = ``0``; i < arr_size; i++)`

`            ``System.out.print(arr[i] + ``" "``);`

`        ``System.out.println(``""``);`

`    ``}`

`    ``/*Driver function to check for above functions*/`

`    public static void main(String[] args){`

`        ``int``arr[] = { ``0``, ``1``, ``1``, ``0``, ``1``, ``2``, ``1``, ``2``, ``0``, ``0``, ``0``, ``1``};`

`        ``int``arr_size = arr.length;`

`        sort012(arr, arr_size);`

`        ``printArray(arr, arr_size);`

`    ``}`

`}`

Practise more Paytm coding interview questions: Placement Preparation with GUVI

### 4. Convert a Binary Tree into its Mirror Tree

#### Code:

Output

```Binary tree is

4 2 5 1 3

Mirror tree is

3 1 5 2 4 ```

### 5. Remove duplicates from an unsorted linked list

Input:

Output:

12->11->21->41->43.

Code:

Output

```Linked list before removing duplicates 10 12 11 11 12 11 10
Linked list after removing duplicates 10 12 11 ```

More articles related to Paytm coding interview questions: Interview Questions

### 6. Write a function to get the Nth node in a Linked List

```Input:  5->10->15->20,  index = 2
Output: 15
The node at index 2 is 15```

Output

`Element at index 3 is 4`

### 7. Delete a node in a Doubly Linked List

#### Code:

Output

```Original Linked list 12  9  6  3

### 8. Delete all the nodes from the doubly linked list that are greater than a given value

Input: 20 31 6 3 11, X = 11
Output: 6 3 11

#### Code:

Output

```Original List: 10 8 4 11 9
Modified List: 8 4 9 ```

### 9. Interchange elements of the first and last rows in the matrix

One of the most asked Paytm coding interview questions:

Input: 6 4 7 0 5
3 2 7 1 2
4 8 1 2 6
5 6 1 1 2

Output: 5 6 1 1 2
3 2 7 1 2
4 8 1 2 6
6 4 7 0 5

#### Code:

Output

```9 9 7 7
4 7 6 5
3 2 1 8
8 9 7 6 ```

### 10. Write a function to print the ZigZag order traversal of a binary tree.

The zigzag order traversal for the below binary tree will be 1 3 2 7 6 5 4.

#### Code:

Output

```ZigZag Order traversal of binary tree is
1 3 2 7 6 5 4 ```

## More Paytm coding interview questions

Definitely, there is more to this. Find the top Paytm coding interview questions on our award-winning practice platform- CODEKATA: where practice always makes you perfect!

For more Paytm coding interview-related questions click here: Placement Preparation with GUVI

Related blogs: Paytm coding interview questions

Paytm Interview Experience

CRED Interview Questions

Amazon Interview Questions

For more queries and suggestions, kindly stick your word to the comment section. We look forward to having a word with you.

Contact Form

By clicking 'Submit' you Agree to Guvi Terms & Conditions.

Our Trending Courses

Our Learners Work at

Our Popular Course

## Author Bio

Archana
A traveler, and explorer, Archana is an active writer at GUVI. You can usually find her with a book/kindle binge-reading (with an affinity to the mystery/humor).

## Our Live Classes

### Full Stack Development Program (FSD)

Learn Javascript, HTML, CSS, Java, Data Structure, MongoDB & more

### IIT-M Advanced Programming & Data Science Program

Learn Python, Machine Learning, NLP, Tableau, PowerBI & more

### Automation and Testing Program

Learn Selenium, Python, Java, Jenkins, Jmeter, API Testing & more

### UI/UX Program

UX Processes, Design systems, Responsive UI, & more with placement assistance.

## Related Articles

If you are reading “var functionName = function and function functionName,” we can understand how confusing it is for you.