Atlassian | Karat

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-04-24Added By Anonymous
Source:Ā Link
🧭 Experience: unknown āœ… Outcome: unknown šŸ’° Compensation: unknown šŸ“ Location: unknown šŸ¢ Company: Atlassian šŸŽ“ Education: unknown šŸŽ Benefits: unknown šŸ“… Offer Date: unknown It consist 0f 2 section 1. He fired somewhere like 5-7 question on scenerio based design , like given scenerio if present flow work or not / what can done to build etc like this. 2 DSA question expection was to implement 1 question and explaon approach for the second if time is there implement it it also has some sort of partial/ step marking as well. Question 1 : was given a word and a list of words we need to find if given word can be formed from same character present in any word of the list. Word1 : sky list - <cry,edt,srk,srrfkrey> -> answer = srrfkrey ``` string findSimilar(vector<string> words,string note){ unordered_map<char, int>noteFreq; for(auto ch:note){ noteFreq[ch]++; } unordered_map<char, int>wordFreq; unordered_map<char, int>duplicateNoteFreq; bool notFound= false; for(string word:words){ duplicateNoteFreq = noteFreq; notFound = false; for(auto ch:word){ duplicateNoteFreq[ch]--; if(duplicateNoteFreq[ch]<0){ notFound= true; } } if(!notFound){ return word; } } return "-"; } ``` Question 2: grid1 = [ ['b', 'b', 'b', 'a', 'l', 'l', 'o', 'o'], ['b', 'a', 'c', 'c', 'e', 's', 'c', 'n'], ['a', 'l', 't', 'e', 'w', 'c', 'e', 'w'], ['a', 'l', 'o', 's', 's', 'e', 'c', 'c'], ['w', 'o', 'o', 'w', 'a', 'c', 'a', 'w'], ['i', 'b', 'w', 'o', 'w', 'w', 'o', 'w'] ] word1_1 = "access" # [(1, 1), (1, 2), (1, 3), (2, 3), (3, 3), (3, 4)] word1_2 = "balloon" # [(0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (1, 7)] Able to do question this impl but need some extra time to make it working ``` void bfsHelper(vector<vector<char>>grid1,string word,int ind, vector<pair<int,int>>&ans , vector<vector<bool>>visited, int r,int c, int row, int col){ if(ind == word.length()) return; int dx[2]={0,-1}; int dy[2]={1, 0}; for(int i =0;i<2;i++){ int xx = r+dx[i]; int yy = c +dy[i]; if(xx < row && xx >=0 && yy<col && yy>=0 ){ if(grid1[xx][yy]==word[ind] && visited[r][c]== false){ ans.push_back({xx,yy}); visited[r][c]= true; bfsHelper(grid1,word,ind+1,ans,visited,xx,yy,row,col); ans.pop_back(); visited[r][c]= false; } else { continue; } } } return; } vector<pair<int,int>> findPath(vector<vector<char>>grid1, string word){ int row = grid1.size(); int col = grid1[0].size(); vector<vector<bool>>visited(row,vector<bool>(col,false)); vector<pair<int,int>>ans; for(int i=0;i<row;i++){ for(int j=0;j<col;j++){ if(grid1[i][j]==word[0]){ ans.push_back({i,j}); visited[i][j]=true; bfsHelper(grid1,word,1,ans,visited,i,j,row,col); ans.pop_back(); visited[i][j]=false; } } } return ans; } ```
Comments