1p3a Question · Oct 2025

Salesforce Online Assessment Experience and Rejection

Question Details

HackerRank Assessment (Duration: 75 minutes) 1. Longest Common Subsequence and Substring

Problem Statement: Given two strings, x and y, determine two specific values: 1. The length of

Full Details

HackerRank Assessment (Duration: 75 minutes) 1. Longest Common Subsequence and Substring

Problem Statement: Given two strings, x and y, determine two specific values: 1. The length of the Longest Common Subsequence (LCS). 2. The length of the Longest Common Substring.

Example: *

Input: x = "abcde", y = "abfce" *

Output: * LCS Length: 3 (e.g., "abe" or "ace") * Longest Common Substring Length: 2 (e.g., "ab") *** 2. Run-Length String Compression

Problem Statement: Compress a given string s using the following rules: * Replace consecutive duplicate characters with the character followed by the count of its repetitions. * If a character appears only once consecutively, leave it unchanged (do not append "1").

Example: *

Input: s = "abbcccd" *

Output: "ab2c3d" *

Logic: * 'a' (1) $\rightarrow$ "a" * 'b' (2) $\rightarrow$ "b2" * 'c' (3) $\rightarrow$ "c3" * 'd' (1) $\rightarrow$ "d"

About This Question

This is a reported interview question from a salesforce interview for a swe role during the oa round reported in 2025.

It covers the following topics: Dynamic Programming, Strings .