Home Icon Home Get Hired Juspay Coding Questions and Answers with Tips for Freshers 2025

Juspay Coding Questions and Answers with Tips for Freshers 2025

Get the Juspay coding questions and answers with tips to help freshers ace the coding round. Boost your chances of success in the interview process of Juspay. Read on for the details.
Schedule Icon 9 mins read
Juspay Coding Questions and Answers with Tips for Freshers 2025

Juspay, a leading fintech company, is known for its rigorous recruitment process that includes coding rounds to assess the technical skills of potential candidates. If you're a fresher aspiring to join Juspay, understanding their coding test pattern, practising relevant coding questions, and knowing how to approach them are essential for success. 

This article will provide you with everything you need to know about the Juspay coding questions, sample coding problems, and interview tips that will help you excel in the hiring process.

What is the Juspay Coding Rounds?

The coding round at Juspay is one of the key stages of their hiring process, designed to evaluate your problem-solving and programming skills. Whether you're applying for a developer position, an internship, or a full-time role, the coding round will test your ability to write clean, efficient, and optimised code under time constraints. 

What to Expect in Juspay Coding Tests? 

Juspay's coding test is typically divided into the following sections:

Data Structures & Algorithms

These questions test your understanding of fundamental data structures (arrays, linked lists, stacks, queues, trees, graphs) and algorithms (sorting, searching, dynamic programming, recursion).

Problem-Solving

You may be given real-world problems related to the fintech industry or algorithmic challenges that require innovative solutions.

Coding Efficiency

The ability to write optimal, efficient code within the given time limit is crucial.

Online Coding Platform

Juspay typically conducts these rounds on platforms like HackerRank or CodeSignal, which means you’ll be expected to write code and test it in a timed environment.

Key Coding Questions You Might Encounter

Here’s a look at some of the typical coding questions in the Juspay coding round:

1. Algorithmic Challenges

  • Sorting & Searching Problems: e.g., "Given a list of transactions, write an efficient algorithm to sort them based on transaction dates."
  • Dynamic Programming: e.g., "Implement an algorithm to find the longest subsequence of transactions where the total value is maximised."

2. Data Structures Problems

  • Linked Lists: e.g., "Reverse a singly linked list in place."
  • Binary Trees: e.g., "Find the height of a binary tree or check if a binary tree is balanced."

3. Real-World Scenarios

  • Payment Gateway Simulation: e.g., "Write a function that simulates a basic payment transaction with checks for valid card number, CVV, and expiry date."
  • Optimisation Problems: e.g., "Optimize the storage of transaction data with limited memory."

Are you looking for coding assessment questions related to job placement? Click here to access coding practice sessions from moderate to challenging levels.

Selected Juspay Coding Test Questions & Answers

Problem Statement 1

You are given a string with alphabets. You need to convert the string to lowercase and check if the string is a palindromic one.

If the string is a palindrome, print the length of the palindromic string. If that string is a non-palindromic one, print the ASCII value of the first character of the alphabet in the given string.

Input Format

The input consists of a single string containing only alphabetic characters (both uppercase and lowercase).

Output Format

Print the Length of the palindromic string if it is a palindrome after performing the above operations. Otherwise, print the ASCII value of the first character.

Solution C++
#include<iostream> 
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;

typedef long int lo; 
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const long double PI =3.141592653589793238462643383279502884197169399375105820974944;
 
void solve () 
{
    string s; 
    getline (cin, s);
    for (int i = 0, j = s.size () - 1; i < j; i++, j--)
    {
        if (toupper (s[i]) != toupper (s[j]))
	    {
            cout << int (s[0]) << "\n";
            return;
        }
    } 
    cout << s.length () << "\n"; 
}

int main ()  
{ 
    ios_base::sync_with_stdio (false);
    cin.tie (NULL);
    ll t = 1;
    //cin>>t;   
    while (t--)
    {
    solve (); 
    }
 
}
Solution Java
import java.util.Scanner;

public class Main {
    public static void solve() {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        
        for (int i = 0, j = s.length() - 1; i < j; i++, j--) {
            if (Character.toUpperCase(s.charAt(i)) != Character.toUpperCase(s.charAt(j))) {
                System.out.println((int) s.charAt(0));
                return;
            }
        }
        System.out.println(s.length());
    }

    public static void main(String[] args) {
        solve();
    }
}
Solution Python
def solve():
    import sys
    input = sys.stdin.read
    s = input().strip()
    
    for i in range(len(s) // 2):
        if s[i].upper() != s[-(i + 1)].upper():
            print(ord(s[0]))
            return
    
    print(len(s))

if __name__ == "__main__":
    solve()

Problem Statement 2

A matrix diagonal is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom-right direction until reaching the matrix's end.

For example, the matrix diagonal starting from mat[2][0], where mat is a 6 x 3 matrix, includes cells mat[2][0], mat[3][1], and mat[4][2].

Given an m x n matrix mat of integers, sort each matrix diagonal in ascending order and return the resulting matrix.

Input Format

The first line contains two integers, M and N, representing the number of rows and columns in the matrix.

The next M lines each contain N integers, representing the elements of the matrix mat. Each line corresponds to a row in the matrix.

Output Format

Print the Diagonally sorted matrix. Each row of the matrix should be printed on a new line.

Solution C++
#include <bits/stdc++.h>
using namespace std;

vector<int> countingSort(vector<int> nums) {
    int min = 1;
    int max = 100;

    int len = max - min + 1;
    vector<int> count(len, 0);

    for (int num : nums) {
        count[num - min]++;
    }

    vector<int> sortedNums;
    for (int i = 0; i < len; i++) {
        for (int times = count[i]; times > 0; times--) {
            sortedNums.push_back(i + min);
        }
    }

    return sortedNums;
}

void sortDiagonal(size_t row, size_t col, vector<vector<int>>& mat) {
    size_t m = mat.size();
    size_t n = mat[0].size();

    vector<int> diagonal;

    size_t diagonal_length = min(m - row, n - col);
    for (size_t i = 0; i < diagonal_length; i++) {
        diagonal.push_back(mat[row + i][col + i]);
    }

    sort(diagonal.begin(), diagonal.end());

    for (size_t i = 0; i < diagonal_length; i++) {
        mat[row + i][col + i] = diagonal[i];
    }
}

vector<vector<int>> diagonalSort(vector<vector<int>>& mat) {
    size_t m = mat.size();
    size_t n = mat[0].size();

    for (size_t row = 0; row < m; row++) {
        sortDiagonal(row, 0, mat);
    }

    for (size_t col = 0; col < n; col++) {
        sortDiagonal(0, col, mat);
    }

    return mat;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> mat(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> mat[i][j];
        }
    }
    
    vector<vector<int>> ans = diagonalSort(mat);

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (j > 0) cout << " ";  // Print space only between elements, not before the first element
            cout << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}
Solution Java
import java.util.*;

public class Main {

    // Method to sort the current diagonal
    private static void sortDiagonal(int row, int col, int[][] mat) {
        int m = mat.length;
        int n = mat[0].length;

        // Store the current diagonal values into a list
        List<Integer> diagonal = new ArrayList<>();
        int diagonalLength = Math.min(m - row, n - col);
        for (int i = 0; i < diagonalLength; i++) {
            diagonal.add(mat[row + i][col + i]);
        }

        // Sort the list of diagonal values
        Collections.sort(diagonal);

        // Build the output for the current diagonal
        for (int i = 0; i < diagonalLength; i++) {
            mat[row + i][col + i] = diagonal.get(i);
        }
    }

    // Method to diagonally sort the matrix
    public static int[][] diagonalSort(int[][] mat) {
        int m = mat.length;
        int n = mat[0].length;

        // Sort diagonals starting from each row
        for (int row = 0; row < m; row++) {
            sortDiagonal(row, 0, mat);
        }

        // Sort diagonals starting from each column
        for (int col = 0; col < n; col++) {
            sortDiagonal(0, col, mat);
        }

        return mat;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[][] mat = new int[n][m];

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                mat[i][j] = scanner.nextInt();
            }
        }

        int[][] sortedMat = diagonalSort(mat);

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (j > 0) System.out.print(" ");  // Print space only between elements
                System.out.print(sortedMat[i][j]);
            }
            System.out.println();
        }

        scanner.close();
    }
}
Solution Python
def sort_diagonal(row, col, mat):
    m = len(mat)
    n = len(mat[0])
    
    # Extract the current diagonal
    diagonal = []
    diagonal_length = min(m - row, n - col)
    for i in range(diagonal_length):
        diagonal.append(mat[row + i][col + i])
    
    # Sort the diagonal values
    diagonal.sort()
    
    # Place sorted values back into the matrix
    for i in range(diagonal_length):
        mat[row + i][col + i] = diagonal[i]

def diagonal_sort(mat):
    m = len(mat)
    n = len(mat[0])
    
    # Sort diagonals starting from each row
    for row in range(m):
        sort_diagonal(row, 0, mat)
    
    # Sort diagonals starting from each column
    for col in range(n):
        sort_diagonal(0, col, mat)
    
    return mat

def main():
    import sys
    input = sys.stdin.read
    data = input().strip().split()
    
    # Read matrix dimensions
    index = 0
    n = int(data[index])
    m = int(data[index + 1])
    index += 2
    
    # Read matrix elements
    mat = []
    for i in range(n):
        row = list(map(int, data[index:index + m]))
        mat.append(row)
        index += m
    
    # Sort the diagonals and print the result
    sorted_mat = diagonal_sort(mat)
    
    for row in sorted_mat:
        print(" ".join(map(str, row)))

if __name__ == "__main__":
    main()

Problem Statement 3

Ronnie is given N coins, each having some value, and provided with a task. In the task, Ronnie has to first arrange the coins in a sorted fashion. After that, he has to set the coins in the form of a tree.

After forming the tree, he has to find the maximum possible absolute value of the difference in that tree, as that will be the profit he will make.

Your task is to help Ronnie find the maximum profit.

Input Format

The first line of the input contains an integer N denoting the number of nodes.

The next line of the input contains N integers.

Output Format

Display the maximum profit that Ronnie can make.

Solution C++
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

struct TreeNode {

    int val;
    TreeNode* left, *right;

    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode* left, TreeNode* right) : val(x), left(left), right(right) {}

};

TreeNode* insertLevelOrder(vector<int>& arr, TreeNode* root, int i, int n) {

    if(i<n) {

        TreeNode* temp = new TreeNode(arr[i]);

        root=temp;

        root->left = insertLevelOrder(arr, root->left, 2*i + 1, n);

        root->right = insertLevelOrder(arr, root->right, 2*i+2, n);
    }
    return root;
}

int ans=0;
void helper(TreeNode* root, int mx, int mn) {

    if(!root) return;

    mx = max(mx, root->val);
    mn = min(mn, root->val);

    ans = max(ans, abs(mx-mn));

    helper(root->left, mx, mn);
    helper(root->right, mx, mn);
}

int maxAncesstorDiff(TreeNode* root) {
    int mx = INT_MIN;
    int mn = INT_MAX;

    helper(root, mx, mn);
    return ans;
}


int main() {
    
    int n;
    cin>>n;
    vector<int> arr(n);
    for(auto &i : arr) cin>>i;

    sort(arr.begin(), arr.end());

    TreeNode* root = insertLevelOrder(arr, root, 0, n);

    int ans = maxAncesstorDiff(root);
    cout<<ans<<endl;
    return 0;
}
Solution Java
import java.util.*;

class TreeNode {

    int val;
    TreeNode left, right;

    TreeNode() {
        this.val = 0;
        this.left = null;
        this.right = null;
    }

    TreeNode(int x) {
        this.val = x;
        this.left = null;
        this.right = null;
    }

    TreeNode(int x, TreeNode left, TreeNode right) {
        this.val = x;
        this.left = left;
        this.right = right;
    }
}

public class Main {

    // Function to insert nodes in level order
    public static TreeNode insertLevelOrder(int[] arr, TreeNode root, int i, int n) {
        if (i < n) {
            TreeNode temp = new TreeNode(arr[i]);
            root = temp;

            // Insert left child
            root.left = insertLevelOrder(arr, root.left, 2 * i + 1, n);

            // Insert right child
            root.right = insertLevelOrder(arr, root.right, 2 * i + 2, n);
        }
        return root;
    }

    static int ans = 0; // Global variable to track the maximum difference

    // Helper function to compute the maximum ancestor difference
    public static void helper(TreeNode root, int mx, int mn) {
        if (root == null) return;

        mx = Math.max(mx, root.val);
        mn = Math.min(mn, root.val);

        ans = Math.max(ans, Math.abs(mx - mn));

        helper(root.left, mx, mn);
        helper(root.right, mx, mn);
    }

    // Function to calculate the maximum ancestor difference
    public static int maxAncestorDiff(TreeNode root) {
        int mx = Integer.MIN_VALUE;
        int mn = Integer.MAX_VALUE;

        helper(root, mx, mn);
        return ans;
    }

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        // Input number of elements
        int n = sc.nextInt();
        int[] arr = new int[n];

        // Input array elements
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }

        // Sort the array
        Arrays.sort(arr);

        // Insert nodes in level order to form a binary tree
        TreeNode root = insertLevelOrder(arr, null, 0, n);

        // Calculate the maximum ancestor difference
        int ans = maxAncestorDiff(root);

        // Output the result
        System.out.println(ans);
    }
}
Solution Python
# Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(input())
nums = list(map(int,input().split()))
print(max(nums)-min(nums))

Problem Statement 4

Archan is a professor at the Academy Of Technology. One day, he calls his student Niladri to play an interesting game. He asked Niladri to imagine an empty bucket. He then does k queries. In each query, he asks Niladri to do either of the following operations:

Add a number v to the bucket.

Get the median of all numbers added to the bucket.

Niladri needs to answer Archan only in the type 2 query. Can you help Niladri to do so?

Note: Answer within one decimal place of the actual answer will be accepted.

Input Format

The first line contains k, which is the number of queries that Archan will ask. K subsequent lines follow.

Each line contains the type of query whether it is “add” or “get” followed by a space and then the value v if it's an “add” query.

The first query will always be “add”. There will be at least one “get” query.

Output Format

The output contains several lines(one or more), each denoting the answer to each “get” query.

The answer should always be formatted to one decimal place.

Solution C++
#include <iostream>
#include <queue>
#include <vector>
#include <iomanip>

using namespace std;

int main() {
    int k;
    cin >> k;

    priority_queue<double> maxHeap;
    priority_queue<double, vector<double>, greater<double>> minHeap;

    vector<double> elements;

    for (int i = 0; i < k; ++i) {
        string queryType;
        cin >> queryType;

        if (queryType == "add") {
            double v;
            cin >> v;
            elements.push_back(v);

            if (maxHeap.empty() || v <= maxHeap.top()) {
                maxHeap.push(v);
            } else {
                minHeap.push(v);
            }

            // Balance the heaps
            if (maxHeap.size() > minHeap.size() + 1) {
                minHeap.push(maxHeap.top());
                maxHeap.pop();
            } else if (minHeap.size() > maxHeap.size()) {
                maxHeap.push(minHeap.top());
                minHeap.pop();
            }
        } else if (queryType == "get") {
            if (elements.size() % 2 == 1) {
                cout << fixed << setprecision(1) << maxHeap.top() << endl;
            } else {
                cout << fixed << setprecision(1) << (maxHeap.top() + minHeap.top()) / 2.0 << endl;
            }
        }
    }

    return 0;
}
Solution Java
import java.util.*;

public class Main {
    private static PriorityQueue<Integer> left = new PriorityQueue<>(Collections.reverseOrder());
    private static PriorityQueue<Integer> right = new PriorityQueue<>();

    public static void addNum(int num) {
        if (left.size() == right.size()) {
            right.add(num);
            left.add(right.poll());
        } else {
            left.add(num);
            right.add(left.poll());
        }
    }

    public static double findMedian() {
        if (left.size() == right.size()) {
            return (right.peek() + left.peek()) / 2.0;
        } else {
            return left.peek();
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();

        while (k-- > 0) {
            String query = scanner.next();

            if ("add".equals(query)) {
                int num = scanner.nextInt();
                addNum(num);
            } else if ("get".equals(query)) {
                System.out.printf("%.1f\n", findMedian());
            }
        }

        scanner.close();
    }
}
Solution Python
import heapq

class MedianFinder:
    def __init__(self):
        self.small = []  # Max heap for smaller half of numbers
        self.large = []  # Min heap for larger half of numbers

    def addNum(self, num):
        if not self.small or num <= -self.small[0]:
            heapq.heappush(self.small, -num)
        else:
            heapq.heappush(self.large, num)

        # Balance the heaps
        if len(self.small) > len(self.large) + 1:
            heapq.heappush(self.large, -heapq.heappop(self.small))
        elif len(self.large) > len(self.small):
            heapq.heappush(self.small, -heapq.heappop(self.large))

    def findMedian(self):
        if len(self.small) == len(self.large):
            return (-self.small[0] + self.large[0]) / 2.0
        else:
            return float(-self.small[0])

def calculate_medians(queries):
    median_finder = MedianFinder()
    results = []
    for query in queries:
        if query[0] == 'add':
            median_finder.addNum(int(query[1]))
        elif query[0] == 'get':
            median = median_finder.findMedian()
            results.append(median)
    return results

# Input
k = int(input().strip())
queries = []
for _ in range(k):
    query = input().strip().split()
    queries.append(query)

# Calculate medians and print results
medians = calculate_medians(queries)
for median in medians:
    print(median)

Problem Statement 5

A park in the city has N trees numbered from 1 to N connected by N-1 pavements. This structure resembles a binary tree rooted at tree '1' where trees represent the vertices and pavements represent its edges.

Each tree has a fruit on it. Some of the fruits are sweet, while others are bitter. The ith tree (1 <= i <= N) has a fruit of sweetness ai. If the fruit is bitter, the value of ai will be negative.

You went to the park to collect fruits. You cannot visit any tree more than once and will have to collect the fruit from each tree you visit from the starting position of your choice. You can decide to return home with all the fruits you collected at any point. Find the maximum value of sweetness that you can collect.

Input Format

The first line contains a single integer N, denoting the number of trees in the park.

The second line contains N integers a1, a2, …, aN, denoting the sweetness of fruit on each of the N trees.

The next N lines describe the binary tree structure of the park. The ith line contains two integers, li and ri, denoting the indices of the left and right children of the ith vertex, respectively. If some child doesn't exist, then the number “-1” is set instead.

It is guaranteed that the given graph is a binary tree rooted at vertex 1.

Output Format

Print a single integer the maximum amount of sweetness you can get from the collected fruits.

Solution C++
#include <bits/stdc++.h>
using namespace std;

// structure for binary tree
struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
vector<pair<int, int>> inp;
vector<int> wt;
// recursive function to construct a binary tree
// from the given input format
void constructTree(int i, TreeNode* node){
    if(inp[i].first > -1){
        node->left = new TreeNode(wt[inp[i].first]);
        constructTree(inp[i].first, node->left);
    }
    if(inp[i].second > -1){
        node->right = new TreeNode(wt[inp[i].second]);
        constructTree(inp[i].second, node->right);
    }
}

// declaring the result value globally
int res;

// Recursive function MaxPath that returns the
// maximum number of sweetness that can be 
// collected from a path including the given node
// and one/zero of its subtrees
int MaxPath(TreeNode* node){
    // base case
    // if the node is NULL, return 0
    if(!node) return 0;

    // compute the MaxPath for left and right
    // subtree recursively, they cannot be negative
    // because we can chose to not select any node
    // instead of a negative path
    int left_path = max(MaxPath(node->left), (int)0);
    int right_path = max(MaxPath(node->right), (int)0);

    // compute result by taking max value of path including
    // the given node and BOTH of its subtrees
    res = max(res, left_path + right_path + node->val);

    // return max value of path including the given node
    // one ONE/ZERO of its subtrees
    return node->val + max(left_path, right_path);
}

int main(){
    // taking inputs and constructing binary tree
    int n;
    cin >> n;
    wt.resize(n);
    for(int i = 0; i < n; i++)
        cin >> wt[i];
    inp.resize(n);
    for(int i = 0; i < n; i++){
        cin >> inp[i].first >> inp[i].second;
        inp[i].first--;
        inp[i].second--;
    }
    // define root node 1
    TreeNode* root = new TreeNode(wt[0]);
    // recursive function to construct binary tree
    constructTree(0, root);
    // let the result be equal to 0 initially
    // 0 is the minimum value of result because
    // we can chose to select none of the nodes
    res = 0;
    // call to recursive function
    // this returns MaxPath including zero and one of
    // its subtrees, but we do not need that value
    // our answer will be computed during the 
    // recursion process
    MaxPath(root);
    // print the computed result
    cout << res << endl;
    return 0;
}
Solution Java
import java.util.*;

public class Solution {
    
    // Define the TreeNode class
    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;
        TreeNode(int x) {
            val = x;
            left = null;
            right = null;
        }
    }
    
    static List<int[]> inp = new ArrayList<>();
    static List<Integer> wt = new ArrayList<>();
    static int res;

    // Recursive function to construct the binary tree
    static void constructTree(int i, TreeNode node) {
        if (inp.get(i)[0] > -1) {
            node.left = new TreeNode(wt.get(inp.get(i)[0]));
            constructTree(inp.get(i)[0], node.left);
        }
        if (inp.get(i)[1] > -1) {
            node.right = new TreeNode(wt.get(inp.get(i)[1]));
            constructTree(inp.get(i)[1], node.right);
        }
    }

    // Recursive function to calculate maximum path sum
    static int maxPath(TreeNode node) {
        if (node == null) return 0;

        int leftPath = Math.max(maxPath(node.left), 0);
        int rightPath = Math.max(maxPath(node.right), 0);

        res = Math.max(res, leftPath + rightPath + node.val);

        return node.val + Math.max(leftPath, rightPath);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        wt = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            wt.add(sc.nextInt());
        }
        
        inp = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            int left = sc.nextInt() - 1;
            int right = sc.nextInt() - 1;
            inp.add(new int[]{left, right});
        }
        
        TreeNode root = new TreeNode(wt.get(0));
        constructTree(0, root);
        
        res = 0;
        maxPath(root);
        
        System.out.println(res);
        sc.close();
    }
}
Solution Python
class TreeNode:
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None

inp = []
wt = []
res = 0

def construct_tree(i, node):
    if inp[i][0] > -1:
        node.left = TreeNode(wt[inp[i][0]])
        construct_tree(inp[i][0], node.left)
    if inp[i][1] > -1:
        node.right = TreeNode(wt[inp[i][1]])
        construct_tree(inp[i][1], node.right)

def max_path(node):
    global res
    if node is None:
        return 0

    left_path = max(max_path(node.left), 0)
    right_path = max(max_path(node.right), 0)

    res = max(res, left_path + right_path + node.val)

    return node.val + max(left_path, right_path)

if __name__ == "__main__":
    n = int(input())
    
    wt = list(map(int, input().split()))
    
    inp = [list(map(int, input().split())) for _ in range(n)]
    inp = [[x-1, y-1] for x, y in inp]  # Convert to 0-based index
    
    root = TreeNode(wt[0])
    construct_tree(0, root)
    
    res = 0
    max_path(root)
    
    print(res)

Juspay Coding Round Tips for Freshers

  • Stay Calm Under Pressure: During coding interviews, it’s essential to stay calm and focused. If you’re stuck on a question, try breaking it down into smaller parts.
  • Practice Efficient Coding: Efficiency matters, especially in the fintech domain where large datasets are common. Always aim to optimise your solutions for both time and space complexity.
  • Communicate Clearly: During your interview, clearly explain your approach and thought process. This not only shows your problem-solving ability but also demonstrates your communication skills.

Conclusion

Juspay’s coding round is a crucial part of their recruitment process. As a fresher, you can increase your chances of success by focusing on mastering algorithms, data structures, and problem-solving techniques. 

By practising coding problems, understanding their application to real-world scenarios, and preparing with the right tools, you'll be ready to ace Juspay’s coding test and make a lasting impression during your interview.

Frequently Asked Questions (FAQs)

1. What is the difficulty level of Juspay coding questions?

The difficulty level can vary from basic data structure problems to complex algorithmic challenges. As a fresher, focus on mastering the basics and gradually work your way up to more advanced topics.

2. How long does the Juspay coding round typically last?

The coding round usually lasts 1-2 hours, depending on the number of questions. You’ll need to manage your time effectively to solve all problems.

3. Should I focus on a specific programming language for Juspay coding tests?

You can use any language you're comfortable with (Java, Python, C++, etc.), but make sure you are proficient in solving problems efficiently in that language.

4. How can I improve my problem-solving skills for Juspay’s coding round?

Practice regularly on coding platforms, analyse solutions, and focus on solving problems that involve algorithms, data structures, and optimisation.

5. Does Juspay provide hints or feedback during the coding round?

No, Juspay does not provide hints during the coding round. You’ll be required to solve the problems independently, so preparation is key.

Disclaimer: While we strive for accuracy, we do not guarantee its completeness or reliability. Readers are encouraged to verify all facts and statistics from the official company website or check independently before making decisions.

Suggested reads:

Edited by
Kaihrii Thomas
Associate Content Writer

Instinctively, I fall for nature, music, humour, reading, writing, listening, travelling, observing, learning, unlearning, friendship, exercise, etc., all these from the cradle to the grave- that's ME! It's my irrefutable belief in the uniqueness of all. I'll vehemently defend your right to be your best while I expect the same from you!

Tags:
Placement

Comments

Add comment
No comments Image No comments added Add comment
Google news icon
Never miss an Update Arrows Icon
Powered By Unstop Logo
Best Viewed in Chrome, Opera, Mozilla, EDGE & Safari. Copyright © 2025 FLIVE Consulting Pvt Ltd - All rights reserved.