Question: IBM Online Assessment (OA) Coding Questions & Solutions | HackerRank Feb2026 | Palindromic Substrings Weight | SQL Wallet Transactions | IBM Coding Round
0
Entering edit mode

Question 1: Sum of Palindromic Substrings Weight

Problem Statement:

Given a string, find the sum of the alphabetic weight of all substrings of the string that are palindromes. Return the answer modulo (10^9 + 7).

For each palindromic substring, its weight is the sum of its characters' positions in the alphabet. i.e., 'a' = 1, 'b' = 2, ..., 'z' = 26.

Note: A palindrome is a string that reads the same from the first character to the last and from the last character to the first.

Example 1:

Input:

s = "abcbd"

Output:

19

 

Question 2: Wallet Transactions (SQL)

Problem Statement: Write a query to list all wallet addresses that have one or more transactions recorded. The output should display the wallet addresses in alphabetical order, including only those wallets whose IDs appear in the transactions table.

Schema: There are 2 tables:

Table: wallets

  • id (SMALLINT): Wallet ID

  • address (VARCHAR(64)): Wallet address

Table: transactions

  • wallet_id (SMALLINT): Wallet ID (Foreign key referencing wallets.id)

  • credit (DECIMAL(4,2)): Transaction amount

Login before adding your answer.

Similar Posts
Loading Similar Posts