Onepay Interview Questions (2026)
1 experiences · 1p3a (1)
One Pay Karat Technical Interview for Software Engineer
Interview Experience
One Pay ### Karat Round Was broadly asked 2 questions which were easy enough but the question was too convoluted to understand the context and answer in a short while. Was given less than 40 minutes. The first question given was to correct the code to pass the test cases. It was mostly a data type fix, the timestamp was a string initially, after changing it to float, the test cases worked. Second question was to write a function to count the total journey of all the users. The interview ended before I could complete the function.
import static org.junit.Assert.assertEquals; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.*; /* We are writing software to analyze logs for toll booths on a highway. This highway is a divided highway with limited access; the only way on to or off of the highway is through a toll booth. There are three types of toll booths: * ENTRY (E in the diagram) toll booths, where a car goes through a booth as it enters the highway. * EXIT (X in the diagram) toll booths, where a car goes through a booth as it exits the highway. * MAINROAD (M in the diagram), which have sensors that record a license plate as a car drives through at full speed. Exit Booth Entry Booth | | X E \ / ---<------------<---------M---------<-----------<---------<---- (West-bound side) =============================================================== (East-bound side) ------>--------->---------M--------->--------->--------->------ / \ E X | | Entry Booth Exit Booth */ /* We are interested in how many people are using the highway, and so we would like to count how many complete journeys are taken in the log file. A complete journey consists of: * A driver entering the highway through an ENTRY toll booth. * The driver passing through some number of MAINROAD toll booths (possibly 0). * The driver exiting the highway through an EXIT toll booth. For example, the following excerpt of log lines contains complete journeys for the cars with JOX304 and THX138: . . . 90750.191 JOX304 250E ENTRY 91081.684 JOX304 260E MAINROAD 91082.101 THX138 110E ENTRY 91483.251 JOX304 270E MAINROAD 91873.920 THX138 120E MAINROAD 91874.493 JOX304 280E EXIT . . 91982.102 THX138 290E EXIT 92301.302 THX138 300E ENTRY 92371.302 THX138 310E EXIT .
2-1) Write a function in LogFile named countJourneys() that returns how many complete journeys there are in the given LogFile. */
class LogEntry { /** * Represents an entry from a single log line. Log lines look like this in the file: * * 34400.409 SXY288 210E ENTRY * * Where: * * 34400.409 is the timestamp in seconds since the software was started. * * SXY288 is the license plate of the vehicle passing through the toll booth. * * 210E is the location and traffic direction of the toll booth. Here, the toll * booth is at 210 kilometers from the start of the tollway, and the E indicates * that the toll booth was on the east-bound traffic side. Tollbooths are placed * every ten kilometers. * * ENTRY indicates which type of toll booth the vehicle went through. This is one of * "ENTRY", "EXIT", or "MAINROAD". **/ private final float timestamp; private final String licensePlate; private final String boothType; private final int location; private final String direction; public LogEntry(String logLine) { String[] tokens = logLine.split(" "); this.timestamp = Float.parseFloat(tokens[0]); this.licensePlate = tokens[1]; this.boothType = tokens[3]; this.location = Integer.parseInt(tokens[2].substring(0, tokens[2].length() - 1)); String directionLetter = tokens[2].substring(tokens[2].length() - 1); if (directionLetter.equals("E")) { this.direction = "EAST"; } else if (directionLetter.equals("W")) { this.direction = "WEST"; } else { throw new IllegalArgumentException(); } } public float getTimestamp() {
**return** timestamp; } public String getLicensePlate() {
**return** licensePlate; } public String getBoothType() {
**return** boothType; } public int getLocation() {
**return** location; } public String getDirection() {
**return** direction; } @Override public String toString() {
**return** String.format( "<LogEntry timestamp: %f license: %s location: %d direction: %s booth type: %s>", timestamp, licensePlate, location, direction, boothType ); } } class LogFile { /* * Represents a file containing a number of log lines, converted to LogEntry * objects. */ List<LogEntry> logEntries; public LogFile(BufferedReader reader) throws IOException { this.logEntries = new ArrayList<>(); String line = reader.readLine(); while (line != null) { LogEntry logEntry = new LogEntry(line.strip()); this.logEntries.add(logEntry); line = reader.readLine(); } } // // HashMap<>(); // entry Hashmap // { // "JOX304" -> "1", // "THX138" -> "2", // } // exit Hashmap // { // "Jox" -> 1, // "THX138" -> "2", // } public int countJourneys() { Map<String, Integer> entryMap = new HashMap<>(); Map<String, Integer> exitMap = new HashMap<>(); for(LogEntry singleLog: this.logEntries) { String singleBoothType = singleLog.getBoothType(); String licensePlate = singleLog.getLicensePlate(); if(singleBoothType == "ENTRY") { entryMap.put(licensePlate, entryMap.getOrDefault(licensePlate, 0) + 1); } else if(singleBoothType == "EXIT") { exitMap.put(licensePlate, entryMap.getOrDefault(licensePlate, 0) + 1); } } int totalCount = 0; for(Map.Entry<String, Integer> entry : entryMap.entrySet()) { String singleLicensePlate = entry.getKey(); int count = entry.getValue(); if(exitMap.containsKey(singleLicensePlate)) { totalCount += exitMap.get(singleLicensePlate); } }
**return** totalCount; } public LogEntry get(int index) {
**return** this.logEntries.get(index); } public int size() {
**return** this.logEntries.size(); } } public class Solution { public static void main(String[] argv) throws IOException { System.out.println("executing main"); testLogFile(); testLogEntry(); testCountJourneys(); } public static void testLogFile() throws IOException { System.out.println("Running testLogFile"); try ( BufferedReader reader = new BufferedReader( new FileReader("/content/test/tollbooth_small.log") ); ) { LogFile logFile = new LogFile(reader); assertEquals(13, logFile.size()); for (LogEntry entry : logFile.logEntries) { assert (entry instanceof LogEntry); } } } public static void testLogEntry() { System.out.println("Running testLogEntry"); String logLine = "44776.619 KTB918 310E MAINROAD"; LogEntry logEntry = new LogEntry(logLine); System.out.println("line 166"); System.out.printf("timestamp is %s
", logEntry.getTimestamp()); assertEquals(44776.619f, logEntry.getTimestamp(), 0.0001); assertEquals("KTB918", logEntry.getLicensePlate()); assertEquals(310, logEntry.getLocation()); assertEquals("EAST", logEntry.getDirection()); assertEquals("MAINROAD", logEntry.getBoothType()); logLine = "52160.132 ABC123 400W ENTRY"; logEntry = new LogEntry(logLine); assertEquals(52160.132f, logEntry.getTimestamp(), 0.0001); assertEquals("ABC123", logEntry.getLicensePlate()); assertEquals(400, logEntry.getLocation()); assertEquals("WEST", logEntry.getDirection()); assertEquals("ENTRY", logEntry.getBoothType()); } public static void testCountJourneys() throws IOException { System.out.println("Running testCountJourneys"); try (BufferedReader reader = new BufferedReader(new FileReader("/content/test/tollbooth_small.log"))) { LogFile logFile = new LogFile(reader); assertEquals(3, logFile.countJourneys()); } try (BufferedReader reader = new BufferedReader(new FileReader("/content/test/tollbooth_medium.log"))) { LogFile logFile = new LogFile(reader); assertEquals(63, logFile.countJourneys()); } } }
Topics
Related companies
Onepay Interview Process Overview
The Onepay interview process typically includes a recruiter screen, one to two technical phone screens, and a 4-6 round on-site or virtual on-site loop. Each round serves a distinct calibration purpose: coding rounds measure correctness, code quality, and complexity reasoning; system design rounds measure architectural judgment at the appropriate level; behavioral rounds measure ownership, leadership scope, and collaboration. Reports tagged on LeakCode from 2024-2026 show Onepay runs a calibrated process consistent with industry norms for companies of its tier.
Difficulty calibration: Onepay coding rounds typically run medium difficulty with follow-up depth as the senior discriminator. System design rounds expect production-grade trade-off articulation at L4+ levels. Behavioral rounds expect quantified outcomes ("reduced p99 latency from 800ms to 120ms") rather than vague impact claims. The candidates who advance consistently demonstrate clear thinking out loud rather than perfect final answers.
How To Use Onepay Question Reports
Real candidate-reported interview questions are a calibration tool, not a memorization target. Onepay updates its question pool every 2-4 months; memorizing exact problems risks misleading you when the interviewer uses a variant. The high-leverage approach: identify the patterns that appear repeatedly in Onepay reports, practice those patterns on similar (not identical) problems, and use the reports to understand the interviewer's typical follow-up depth.
Filter the questions above by round type, difficulty, and recency. Focus first on reports from the past 6-12 months; older reports may reference questions that have since rotated out of Onepay's pool. Reports tagged with quantified difficulty and explicit round type are higher-signal than reports without those tags. The metadata filters help you build a focused study plan in 1-2 hours rather than 8-10 hours of unstructured browsing.
Common Onepay Interview Mistakes
Reports tagged "no hire" at Onepay consistently surface a few patterns: jumping into code without clarifying requirements, coding silently for extended periods, missing edge cases (empty input, single element, large input, overflow), producing working code the candidate cannot refactor when probed, and behavioral stories that use "we" instead of "I" diluting individual signal. Strong candidates explicitly avoid these patterns by following a consistent round template.
The single most predictive failure mode in recent reports: not asking clarifying questions. Interviewers are explicitly trained to weight this dimension. Strong candidates ask 3-5 clarifying questions even on problems that look obvious; weak candidates dive into implementation immediately. Strong candidates also verbalize their approach before writing code; weak candidates code in silence and lose the communication dimension of the round's calibration.