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

Add palindrome check function in C++ basics #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ohhpeejoshi wants to merge 2 commits into quicksnip-dev:main from ohhpeejoshi:add-cpp-basics
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion public/data/cpp.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
{
"title": "Split String",
"description": "Splits a string by a delimiter",
"description": "Splits a string by a delimiter.",
"code": [
"#include <string>",
"#include <vector>",
Expand All @@ -58,6 +58,30 @@
],
"tags": ["cpp", "string", "split", "utility"],
"author": "saminjay"
},
{
"title": "Palindrome Check",
"description": "Checks if a given string is a palindrome (reads the same forwards and backwards).",
"code": [
"#include <string>",
"",
"// Function to check if a given string is a palindrome",
"bool isPalindrome(const std::string& str) {",
" int left = 0;",
" int right = str.length() - 1;",
" ",
" // Compare characters from both ends",
" while (left < right) {",
" if (str[left] != str[right]) // If characters don't match, it's not a palindrome",
" return false;",
" left++;",
" right--;",
" }",
" return true; // If all characters match, it's a palindrome",
"}"
],
"tags": ["cpp", "string", "palindrome", "utility"],
"author": "ohhpeejoshi"
}
]
}
Expand Down

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /