Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

jaygajera17/leetcode_gfg_string_problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

22 Commits

Repository files navigation

gfg_string_question

https://www.geeksforgeeks.org/top-50-string-coding-problems-for-interviews/

Importance

  • playing with characters test logic of programmer very well
  • understanding of C++ Standard Template Library(STL) also increase
  • frequently asked string coding questions in every coding round

Key Points

ascii value:-

  • 48 to 57 - Number
  • 65 to 90 - uppercase [(s[0]>='a'&&s[0]<='z']
  • 97 to 122 - lowercase [(s[0]>='A'&&s[0]<='Z']
  • lowercase = lowercase + 32

inbuilt Method:-

  • toupper:- (char)tolower(s[i]);
  • tolower:- (char)toupper(s[i]);

Transform:-

  • transform(s.begin(), s.end(), s.begin(), ::tolower);

  • transform(s.begin(), s.end(), s.begin(), ::toupper);

  • Find:- s1.find(s2[i])!=string::npos:- it means <find s2[i] in s1> is present

  • token:- stringstream ex:
    string s = "geeks for geeks"; stringstream ss(s); // Used for breaking words
    string word; // to store individual words
    while (ss >> word)
    cout << word << endl;

  • next_permutation()

AltStyle によって変換されたページ (->オリジナル) /