DSC-IIITL / GitGrind

8 stars 59 forks source link

Added solution for Question_7 #70

Closed Priyanshu-2005 closed 11 months ago

Priyanshu-2005 commented 11 months ago

@akhilender-bongirwar @shishiro26 @PavanaSakethaRam @Illuminati9 @Kota-Karthik

provided solution for Question_7 issue #61

logic of code and approach: input all the strings in a vector use loops for iterating over strings first keep i pointer at string 1 and compare it with all other strings then i pointer to string 2 and compare it with rest strings store the frequencies of each character of each string start with string 1 and string 2 store the frequency of each character of string 1 in one map and same with string 2 in second map compare both if the frequencies of each letter come out to be the same then store that string in third map as a key and increment its value by 1

like this compare string 1 with string 3 and so on then move the i pointer to string 2 and j pointer to string 3 and then compare like this

at end compare all the key,value in map 3 the string having maximum value is displayed as output

added screenshots as well Screenshot from 2023-10-22 20-33-01

Priyanshu-2005 commented 11 months ago

@PavanaSakethaRam @shishiro26 kindly review the code