0% found this document useful (0 votes)
3 views3 pages

Mastercard Java Coding Interview Prep

The document outlines key coding problems and concepts for preparing for a senior/lead Java software engineer interview at Mastercard. It covers various topics including data structures, algorithms, concurrency, low-level design, and Java-specific coding challenges. Additionally, it provides best practices for coding interviews such as clarifying requirements and optimizing solutions.

Uploaded by

nareshbabuy4u
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Mastercard Java Coding Interview Prep

The document outlines key coding problems and concepts for preparing for a senior/lead Java software engineer interview at Mastercard. It covers various topics including data structures, algorithms, concurrency, low-level design, and Java-specific coding challenges. Additionally, it provides best practices for coding interviews such as clarifying requirements and optimizing solutions.

Uploaded by

nareshbabuy4u
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Mastercard – Senior/Lead Java Software Engineer

Coding Interview Preparation

Core Data Structure Coding

• Two Sum – find two numbers that add to a target using HashMap (O(n)).

• Longest Substring Without Repeating Characters – sliding window.

• Merge Two Sorted Linked Lists.

• Reverse a Linked List (iterative and recursive).

• Detect Cycle in Linked List – Floyd’s slow/fast pointer.

Array / Sliding Window

• Maximum Subarray Sum (Kadane’s Algorithm).

• Product of Array Except Self (no division).

• Move Zeros to End.

• Find Missing Number using XOR or sum formula.

String Problems

• Valid Parentheses – stack.

• Group Anagrams – HashMap with sorted keys.

• String Compression.

• Longest Palindromic Substring.

Tree / Graph Coding

• Binary Tree Level Order Traversal (BFS).

• Lowest Common Ancestor in Binary Tree.

• Check if Binary Tree is Balanced.

• Number of Islands – DFS/BFS in grid.

HashMap / Frequency

• Top K Frequent Elements – heap or bucket sort.


• First Non-Repeating Character in String.

Concurrency (Senior Java)

• Print Odd/Even numbers using two threads.

• Producer–Consumer using BlockingQueue or wait/notify.

• Thread-safe Singleton using Double Checked Locking.

Low-Level Design Coding

• Implement LRU Cache with HashMap + Doubly Linked List (O(1)).

• Design a Rate Limiter (token bucket or sliding window).

• Design a URL Shortener encode/decode methods.

Payment / Transaction Style Problems

• Aggregate transactions and find top 3 users with highest spend.

• Detect fraud if a card has more than 3 transactions within 10 seconds.

• Log processing – find most active users in last 5 minutes.

Java-Specific Coding

• Custom Comparator to sort transactions by amount desc then timestamp.

• Java Stream API – find top 3 highest salaries.

Hard Problems

• Median of Two Sorted Arrays (logarithmic solution).

• Sliding Window Maximum.

• Merge K Sorted Lists using Min Heap.

Coding Interview Best Practices

• Clarify requirements before coding.

• Explain brute-force approach first.

• Optimize and discuss time/space complexity.


• Write clean, readable Java code.

• Test with edge cases.

You might also like