From 3a6248c4a906524b2282e36f286fcdc7739e33c4 Mon Sep 17 00:00:00 2001 From: Arpit Joshi Date: Wed, 1 Jan 2025 14:52:33 +0530 Subject: [PATCH 1/2] Add palindrome check function in C++ basics --- public/data/cpp.json | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/public/data/cpp.json b/public/data/cpp.json index d1ff6b2d..47919b92 100644 --- a/public/data/cpp.json +++ b/public/data/cpp.json @@ -39,7 +39,7 @@ }, { "title": "Split String", - "description": "Splits a string by a delimiter", + "description": "Splits a string by a delimiter.", "code": [ "#include ", "#include ", @@ -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 ", + "", + "// 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": "Arpit-Joshi" } ] } From 4745f7c3ba846f8eea714585bd4500e2cd57e93f Mon Sep 17 00:00:00 2001 From: Arpit Joshi Date: Wed, 1 Jan 2025 15:00:18 +0530 Subject: [PATCH 2/2] Add palindrome check function in C++ basics --- public/data/cpp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/data/cpp.json b/public/data/cpp.json index 47919b92..040ffa13 100644 --- a/public/data/cpp.json +++ b/public/data/cpp.json @@ -81,7 +81,7 @@ "}" ], "tags": ["cpp", "string", "palindrome", "utility"], - "author": "Arpit-Joshi" + "author": "ohhpeejoshi" } ] } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy