Cashfree Frontend Intern Online assessment

cashfree logo
cashfree
Frontend Intern
June 18, 20255 reads

Summary

I participated in Cashfree's Frontend Intern online assessment in mid-June, which included general knowledge questions and three coding problems, and I was selected for the interview round.

Full Experience

I had Participated in Cashfree Frontend Intern on mid of june had my OA scheduled and was asked 5 on Error codes , linkedList ,user experience and graph later I had 3 question 2 dsa question and 1 node.js (javascript Q). verdict selected for interview

Interview Questions (3)

Q1
The Employee That Worked on the Longest Task
Data Structures & AlgorithmsEasy

LeetCode problem 2432: The Employee That Worked on the Longest Task.

Q2
Distinct One Counts After One Flip
Data Structures & Algorithms

Problem: Distinct One Counts After One Flip

You are given a binary array arr of length n, consisting only of 0s and 1s.

You are allowed to choose exactly one subarray (possibly empty) and flip all of its elements — that is, convert all 0s in the subarray to 1s, and all 1s to 0s.

Your task is to determine how many distinct values for the total number of 1s in the array can be obtained after performing exactly one flip operation.


Function Signature

int getDistinctOneCounts(vector<int> arr);

Input

  • arr: A vector of n integers, where each element is either 0 or 1.
  • Constraints:
    • $1 \leq n \leq 2 \times 10^5$
    • Each element of arr is either 0 or 1.

Output

  • Return an integer representing the number of distinct possible counts of 1s in the array after exactly one subarray flip operation.

Note

  • A subarray is a contiguous portion of the array.
  • You are allowed to flip an empty subarray, which results in no change to the array.

Example

Input

arr = [0, 1, 1, 0]

Output

4

Explanation

Possible flips and resulting 1-counts:

Subarray Chosen (0-based indices)Flipped ArrayNumber of 1s
None (empty subarray)[0, 1, 1, 0]2
[0, 0][1, 1, 1, 0]3
[1, 2][0, 0, 1, 0]1
[0, 3][1, 0, 0, 1]2
[0, 1][1, 0, 1, 0]2
[2, 3][0, 1, 0, 1]2
[1, 3][0, 0, 0, 1]1
[0, 2][1, 0, 0, 0]1
[1, 2][0, 0, 0, 0]0

The distinct counts of 1s after these flips are: {0, 1, 2, 3} → total 4 distinct values.


Q3
Custom Auction System
System Design

Problem: Custom Auction System

You are building a custom auction system with unique bidding rules:

  • An auction starts with an initial price.
  • Bidders can place bids via updatePrice, but only if their bid is higher than the current bid.
  • To win the item, a bidder must explicitly claim it using callBid with a valid offer.
  • Once an item is claimed via a successful callBid, no further bids or claims are allowed on it.

Function Definitions

You need to implement the following three functions to manage the auction process:


1 startAuction(auctions, entity, startingPrice)

Starts an auction for a given item.

  • Parameters:
    • auctions (object): A shared object that stores all auctions.
    • entity (string): The name of the item.
    • startingPrice (number): The minimum price to start the auction.
  • Returns: Nothing (updates the auctions object).

2 updatePrice(auctions, entity, bidPrice)

Places a new bid for the item.

  • A new bid is only accepted if it is greater than both the starting price and the current highest bid.
  • Bids are ignored if the item has already been claimed.
  • Parameters:
    • auctions (object): The shared auction data.
    • entity (string): The item being bid on.
    • bidPrice (number): The new bid price.
  • Returns: Nothing (updates the bid in auctions).

3️ callBid(auctions, entity, callPrice)

Attempts to claim the item with a final offer.

  • If the item is unclaimed and the callPrice is greater than or equal to the current bid, the call is "successful" and the item is marked as sold.
  • Otherwise, the call is "unsuccessful".
  • Parameters:
    • auctions (object): The shared auction data.
    • entity (string): The item to claim.
    • callPrice (number): The price the bidder wants to claim the item at.
  • Returns: "successful" or "unsuccessful"

Sample Test Case 0

Input

startAuction vase 100
updatePrice vase 150
updatePrice vase 200
callBid vase 210

Output

successful

Explanation:

  • Auction for vase starts at 100.
  • Bids of 150 and 200 are valid and update the price.
  • A callBid of 210 is higher than the current bid (200) — item is claimed.

Sample Test Case 1

Input

startAuction car 5000
callBid car 4500
callBid car 5000

Output

unsuccessful
successful

Explanation:

  • callBid of 4500 is below starting price — rejected.
  • callBid of 5000 is equal to starting price — accepted.

Constraints

  • Item names are unique lowercase English strings (1 ≤ length ≤ 100).
  • 1 ≤ startingPrice, bidPrice, callPrice ≤ 10^5.
  • Once claimed, no further updates or claims are allowed on that item.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!