Google Screening Round [Selected]

Anonymous User
1448
Apr 29, 2025
Apr 29, 2025

Hi All,

I had my Screening round on 28th April, I was asked one DSA question

Given a string check whether it can be formed using the periodic table.

eg. P H Y Si Cs -> true
Leetcode -> false

Question I asked: Assuming Periodic table is given and can be acccessed in O(1) time using unordered_set

I started with recursion approach, becuase in Periodic table we have elements of len 1 or 2
so if I am at ith index I have 2 choices take 1 char or take 2 char.

using this I formed recursive algo, TC : 2^N , SC: O(N) recursive stack space.

then used memorization with 1D DP

converted my solution to Buttom Up //optional I did for my understanding to convert O(N) space to O(1) space

and finally reduced space complexity to O(1) becuase each index will depend only its next and nextOfNext.

I was able to code all but with time ticking messed up at last for few bugs.

Verdict: Selected for Onsite Rounds, feeback -> improve debug/code fixing skills

Comments (12)