DSC-IIITL / GitGrind

8 stars 59 forks source link

fixed bug for paired character problem #59

Closed Priyanshu-2005 closed 11 months ago

Priyanshu-2005 commented 11 months ago

@akhilender-bongirwar

solved issue #18

akhilender-bongirwar commented 11 months ago

@Priyanshu-2005, provide the screenshots for output.

Priyanshu-2005 commented 11 months ago

@akhilender-bongirwar logic initialize an array of 256 length using loop traverse through the string(only even indices according to the question) and count the freq of characters now add the minimum of small letter frequency or capital letter frequency to the counter variable which indicates the no. of pairs possible of that alphabet (even positions only and 0 index according to the problem statement )

changes made used array instead of unordered map started loop from i=0 instead of i=1 loop goes till i<2n instead of i<2(n-1) also the logic inside the for loop changed

Priyanshu-2005 commented 11 months ago

Screenshot from 2023-10-21 23-11-05 Screenshot from 2023-10-21 23-11-11

Priyanshu-2005 commented 11 months ago

@akhilender-bongirwar added the screenshots and logic