PayU JavaScript Interview Questions 2026
Published July 22, 2026 · Updated July 22, 2026
20 real JavaScript interview questions asked at PayU. Upvoted by engineers who cleared the loop. Covers Technical, System Design rounds.
20 questions
1106 engineers asked
1556 upvotes
Company: PayU
Technology: JavaScript
All JavaScript Questions Asked at PayU
PayU
Medium
Technical round
2–5 YearsInterview ExperienceJavaScriptJavaPython
Given an array of transaction amounts, find all pairs whose sum equals a given target. Return the count of unique pairs. For example: [100, 200, 300, 400], target = 500 → pairs: (100,400), (200,300) → count: 2. What is the time and space complexity of your approach?
↑ 61 upvotes · 42 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceJavaScriptJava
You have an array of daily payment failure counts for the past 30 days. Find the longest contiguous subarray where failures stayed below a given threshold k. Explain your sliding window approach and walk through the algorithm step by step.
↑ 48 upvotes · 33 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceJavaScriptJava
Given a list of payment events, each with a merchant ID and an amount, use a HashMap to return the top 3 merchants by total transaction volume. How would you handle ties? Write the complete solution.
↑ 57 upvotes · 39 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceJavaScript
Implement a function that detects duplicate transaction IDs within a 5-minute time window. Given an array of {id, timestamp} objects, return all IDs that appear more than once within any 5-minute rolling window. What data structure would you use and why?
↑ 72 upvotes · 51 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceJavaScriptJavaPython
Given a 2D matrix representing a payment heatmap (rows = hours, columns = days), find the submatrix with the maximum sum. The submatrix represents the peak payment activity window. Describe your approach — can you do better than O(n³)?
↑ 44 upvotes · 29 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceJavaScript
Design an in-memory rate limiter that allows at most N requests per user per minute. Given a stream of {userId, timestamp} requests, return true if the request should be allowed or false if it should be throttled. Implement using JavaScript.
↑ 83 upvotes · 58 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceJavaScript
What will the following code output and why?
const obj = { x: 10 };
const fn = () => console.log(this.x);
obj.fn = fn;
obj.fn();
Now rewrite fn as a regular function. How does the output change and what is the reason?
↑ 91 upvotes · 67 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceJavaScript
Predict the output of this code:
console.log(1);
setTimeout(() => console.log(2), 0);
Promise.resolve().then(() => console.log(3));
console.log(4);
Explain the event loop mechanism that determines this order.
↑ 104 upvotes · 78 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceJavaScriptReact
Implement a debounce function from scratch in JavaScript. Then explain where you would use debounce vs throttle in a payment checkout flow — for example on a search input, a "Pay Now" button, and a scroll event handler.
↑ 88 upvotes · 62 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceReactJavaScript
Explain the reconciliation algorithm in React. How does React decide which DOM nodes to update when state changes? What is the role of the key prop and what happens when you use an array index as a key versus a stable unique ID?
↑ 96 upvotes · 71 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceReactJavaScript
Build a custom useFetch hook in React that accepts a URL, returns { data, loading, error }, handles component unmount (cleanup), and prevents state updates on an unmounted component. Show the complete implementation.
↑ 82 upvotes · 59 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceReactJavaScript
Implement a reusable PaymentForm component in React with fields for card number, expiry, and CVV. Add real-time validation using controlled components: card number must be 16 digits, expiry must be a future month, CVV 3–4 digits. No external libraries.
↑ 74 upvotes · 53 engineers asked this · Full Stack Developer
PayU
Medium
Technical round
2–5 YearsInterview ExperienceReactJavaScript
You need to implement optimistic UI for a "Add to Cart" button in a React e-commerce app. When the user clicks, the UI should update immediately, but revert if the API call fails. How would you implement this pattern without any state management library?
↑ 79 upvotes · 55 engineers asked this · Full Stack Developer
PayU
Hard
Technical round
2–5 YearsInterview ExperienceJavaScript
Implement Promise.allSettled from scratch without using the native method. Then explain the difference between Promise.all, Promise.allSettled, Promise.any, and Promise.race — give a concrete payment flow example for when you would use each.
↑ 97 upvotes · 69 engineers asked this · Full Stack Developer
PayU
Hard
Technical round
2–5 YearsInterview ExperienceJavaScript
A payment API call must retry up to 3 times on network failure, with exponential backoff (1s, 2s, 4s delays) between attempts. Implement a retryWithBackoff(fn, maxRetries) utility using Promises. Handle the case where all retries fail.
↑ 88 upvotes · 63 engineers asked this · Full Stack Developer
PayU
Hard
System Design round
2–5 YearsInterview ExperienceJavaScriptReactSecurity
Design the frontend architecture for a PayU checkout SDK that can be embedded in any merchant website as a script tag. It must render a payment form in an iframe, handle cross-origin communication, support multiple payment methods (card, UPI, netbanking), and work across React, Vue, and plain HTML merchant sites.
↑ 81 upvotes · 57 engineers asked this · Full Stack Developer
PayU
Hard
System Design round
2–5 YearsInterview ExperienceReactJavaScript
You are building a multi-step payment flow: Cart → Address → Payment Method → OTP → Confirmation. Each step has its own data, validation, and API calls. How would you architect state management for this flow in React without Redux? Discuss trade-offs.
↑ 85 upvotes · 61 engineers asked this · Full Stack Developer
PayU
Hard
Technical round
2–5 YearsInterview ExperienceReactJavaScript
Design and implement a recursive category tree component in React for a merchant product catalogue. The tree can be N levels deep, each node can be expanded/collapsed independently, and the selected path must be highlighted. Clicking a leaf node should emit the full path (e.g. "Electronics > Phones > Android"). Optimise to avoid re-rendering siblings when one node is toggled.
↑ 76 upvotes · 54 engineers asked this · Full Stack Developer
PayU
Hard
Technical round
2–5 YearsInterview ExperienceJavaScriptReactPerformance
A merchant reports that their checkout page built with your SDK scores 38 on Google Lighthouse. Walk through your systematic debugging process: which Core Web Vitals are likely failing, what tools you would use, and give five concrete optimisations specific to a payment checkout flow.
↑ 79 upvotes · 56 engineers asked this · Full Stack Developer
PayU
Hard
System Design round
2–5 YearsInterview ExperienceJavaScriptReactSystem Design
PayU wants to run A/B tests on the checkout button colour and payment method ordering to improve conversion rates. As the frontend engineer, how would you design the experimentation infrastructure: flag evaluation, consistent user bucketing, avoiding layout shift between variants, and measuring the right success metrics?
↑ 71 upvotes · 49 engineers asked this · Full Stack Developer
Practice these questions with AI feedback
Get instant grading on your answers, identify your weak areas, and generate a personalised 14-day study plan — all free.
Build my study plan →
More PayU Questions
JavaScript Questions at Other Companies
Browse by company
Frequently asked questions
Given an array of transaction amounts, find all pairs whose sum equals a given target. Return the count of unique pairs. For example: [100, 200, 300, 400], target = 500 → pairs: (100,400), (200,300) → count: 2. What is the time and space complexity of your approach?
Given an array of transaction amounts, find all pairs whose sum equals a given target. Return the count of unique pairs. For example: [100, 200, 300, 400], target = 500 → pairs: (100,400), (200,300) → count: 2. What is the time and space complexity of your approach?
You have an array of daily payment failure counts for the past 30 days. Find the longest contiguous subarray where failures stayed below a given threshold k. Explain your sliding window approach and walk through the algorithm step by step.
You have an array of daily payment failure counts for the past 30 days. Find the longest contiguous subarray where failures stayed below a given threshold k. Explain your sliding window approach and walk through the algorithm step by step.
Given a list of payment events, each with a merchant ID and an amount, use a HashMap to return the top 3 merchants by total transaction volume. How would you handle ties? Write the complete solution.
Given a list of payment events, each with a merchant ID and an amount, use a HashMap to return the top 3 merchants by total transaction volume. How would you handle ties? Write the complete solution.
Implement a function that detects duplicate transaction IDs within a 5-minute time window. Given an array of {id, timestamp} objects, return all IDs that appear more than once within any 5-minute rolling window. What data structure would you use and why?
Implement a function that detects duplicate transaction IDs within a 5-minute time window. Given an array of {id, timestamp} objects, return all IDs that appear more than once within any 5-minute rolling window. What data structure would you use and why?
Given a 2D matrix representing a payment heatmap (rows = hours, columns = days), find the submatrix with the maximum sum. The submatrix represents the peak payment activity window. Describe your approach — can you do better than O(n³)?
Given a 2D matrix representing a payment heatmap (rows = hours, columns = days), find the submatrix with the maximum sum. The submatrix represents the peak payment activity window. Describe your approach — can you do better than O(n³)?
Design an in-memory rate limiter that allows at most N requests per user per minute. Given a stream of {userId, timestamp} requests, return true if the request should be allowed or false if it should be throttled. Implement using JavaScript.
Design an in-memory rate limiter that allows at most N requests per user per minute. Given a stream of {userId, timestamp} requests, return true if the request should be allowed or false if it should be throttled. Implement using JavaScript.
What will the following code output and why?
What will the following code output and why?
const obj = { x: 10 };
const fn = () => console.log(this.x);
obj.fn = fn;
obj.fn();
Now rewrite fn as a regular function. How does the output change and what is the reason?
Predict the output of this code:
Predict the output of this code:
console.log(1);
setTimeout(() => console.log(2), 0);
Promise.resolve().then(() => console.log(3));
console.log(4);
Explain the event loop mechanism that determines this order.