Welcome to the Hacktoberfest 2023 Competitive-Programming Cohort for Cummins College and MMCOE students! To request issue assignment, create a pull request, providing: 1. Full Name 🧑🎓 2.Email 📧 3.College ID (RNO) 🔢 4.Branch of Study.📚 5. Year 📆 .The Cummins College and MMCOE students' PRs will be considered only. Thank you!
9
stars
69
forks
source link
Issue #61 : Added Code for first Non-Repeating Character in a Stream #218
For this problem I'm first counting the frequency of the character with the help of unordered map and if it is less than 0 then I'm pushing that character in a vector & then appending the 0th index character of the vector in the answer string. And if the frequency is greater than 0 then I'm first erasing that character from the vector, after erasing I'm checking if the vector is empty If it is then I'm appending '#' to the answer string otherwise I'm appending the 0th index character of vector to answer string.
61
For this problem I'm first counting the frequency of the character with the help of unordered map and if it is less than 0 then I'm pushing that character in a vector & then appending the 0th index character of the vector in the answer string. And if the frequency is greater than 0 then I'm first erasing that character from the vector, after erasing I'm checking if the vector is empty If it is then I'm appending '#' to the answer string otherwise I'm appending the 0th index character of vector to answer string.
Time Complexity : O(n) Space Complexity : O(n)