Question: Alacriti, Recently Asked Online Assessments in 14 Mar, 2026 | Customer Activity SQL | Group Anagram Frequency | Aggregation & Hashmaps
0
Entering edit mode

Question 1: Customer Activity (SQL)

Problem Statement:You are provided with three tables,customers,accounts, andtransactions, containing information about bank customers, their accounts, and transaction activity. Your task is to identify the customers who were active.

A customer is considered active if:

  • They own at least one account.
  • They made at least 3 transactions in 2024.
  • Their total deposits in 2024 must exceed 50,000.

Return:customer_id,full_name,city,total_accounts,total_transactions_2024,total_deposits_2024in descending order oftotal_deposits_2024.

Table Description:Table:customers

 


Question 2: Group Anagram Frequency Tracker

Problem Statement:You are given a vector of N strings and Q queries. Each query contains a string, and you need to determine how many anagrams of that query string exist in the original vector. Two strings are anagrams if they contain the same characters with the same frequencies, regardless of order. You must preprocess the vector efficiently to handle multiple queries quickly using hashmaps and collections.

Your task is to build a frequency map of the strings that are anagrams of each other are grouped together, then answer each query by returning the count of strings in the vector that are anagrams of the query string.

Function Description:You need to implement the functioncountAnagramGroups. The function should preprocess the vector of strings by grouping the anagrams using a hashmap, then for each query string return the count of its anagrams in the original vector.

Function Parameters:

  • N:An integer representing the number of strings in the vector. (Note: The strings vector and queries array are also passed as implicit inputs).
ADD COMMENTlink 7 days ago Sarthak • 10

Login before adding your answer.

Similar Posts
Loading Similar Posts