Skip to content

Commit 969cee7

Browse files
authored
Merge pull request #4018 from Ridhima10/ecomm
Ecomm
2 parents 229f47b + 3ca0199 commit 969cee7

File tree

3 files changed

+39
-31
lines changed

3 files changed

+39
-31
lines changed

dsa-solutions/lc-solutions/0900-0999/0906-super-palindromes.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
id: super-palindromes
33
title: Super Palindromes
44
sidebar_label: Super Palindromes
5-
tags:
6-
- Palindrome
7-
- Math
5+
tags:
6+
- Palindrome
7+
- Math
88
---
99

1010
## Problem Description
1111

12-
| Problem Statement | Solution Link | LeetCode Profile |
13-
| :-------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- | :--------------------------------------------------- |
12+
| Problem Statement | Solution Link | LeetCode Profile |
13+
| :------------------------------------------------------ | :------------------------------------------------------------------------- | :------------------------------------------------------ |
1414
| [Super Palindromes](https://leetcode.com/problems/super-palindromes/description/) | [Super Palindromes Solution on LeetCode](https://leetcode.com/problems/super-palindromes/solutions/) | [Nikita Saini](https://leetcode.com/u/Saini_Nikita/) |
1515

1616
## Problem Description
@@ -62,7 +62,7 @@ def super_palindromes(left, right):
6262
left, right = int(left), int(right)
6363
count = 0
6464
limit = int(math.sqrt(right)) + 1
65-
65+
6666
for i in range(1, limit):
6767
s = str(i)
6868
pal = s + s[::-1]
@@ -71,14 +71,14 @@ def super_palindromes(left, right):
7171
break
7272
if num >= left and is_palindrome(str(num)):
7373
count += 1
74-
74+
7575
pal = s + s[-2::-1]
7676
num = int(pal) ** 2
7777
if num > right:
7878
break
7979
if num >= left and is_palindrome(str(num)):
8080
count += 1
81-
81+
8282
return count
8383
```
8484

@@ -178,7 +178,7 @@ int superPalindromes(char* left, char* right) {
178178
for (long long i = 1; i < limit; i++) {
179179
sprintf(s, "%lld", i);
180180
int len = strlen(s);
181-
181+
182182
// Palindrome of even length
183183
snprintf(pal, 40, "%s%s", s, strrev(strdup(s)));
184184
long long num1 = atoll(pal) * atoll(pal);
@@ -200,29 +200,28 @@ int superPalindromes(char* left, char* right) {
200200

201201
```javascript
202202
function isPalindrome(s) {
203-
return s === s.split("").reverse().join("");
203+
return s === s.split('').reverse().join('');
204204
}
205205

206206
function superPalindromes(left, right) {
207-
let l = BigInt(left),
208-
r = BigInt(right);
209-
let count = 0;
210-
let limit = BigInt(Math.sqrt(Number(r))) + BigInt(1);
211-
212-
for (let i = BigInt(1); i < limit; i++) {
213-
let s = i.toString();
214-
let pal1 = s + s.split("").reverse().join("");
215-
let num1 = BigInt(pal1) ** BigInt(2);
216-
if (num1 > r) break;
217-
if (num1 >= l && isPalindrome(num1.toString())) count++;
218-
219-
let pal2 = s + s.slice(0, -1).split("").reverse().join("");
220-
let num2 = BigInt(pal2) ** BigInt(2);
221-
if (num2 > r) break;
222-
if (num2 >= l && isPalindrome(num2.toString())) count++;
223-
}
224-
225-
return count;
207+
let l = BigInt(left), r = BigInt(right);
208+
let count = 0;
209+
let limit = BigInt(Math.sqrt(Number(r))) + BigInt(1);
210+
211+
for (let i = BigInt(1); i < limit; i++) {
212+
let s = i.toString();
213+
let pal1 = s + s.split('').reverse().join('');
214+
let num1 = BigInt(pal1) ** BigInt(2);
215+
if (num1 > r) break;
216+
if (num1 >= l && isPalindrome(num1.toString())) count++;
217+
218+
let pal2 = s + s.slice(0, -1).split('').reverse().join('');
219+
let num2 = BigInt(pal2) ** BigInt(2);
220+
if (num2 > r) break;
221+
if (num2 >= l && isPalindrome(num2.toString())) count++;
222+
}
223+
224+
return count;
226225
}
227226
```
228227

@@ -231,13 +230,12 @@ function superPalindromes(left, right) {
231230
1. **Generate Palindromes:**
232231
- Iterate through possible values of `i` from 1 to the square root of the right boundary.
233232
- Construct palindromes by concatenating `s` with its reverse and with its reverse minus the last character.
233+
234234
2. **Square Palindromes:**
235-
236235
- Compute the square of each palindrome.
237236
- Check if the squared value is within the range `[left, right]`.
238237

239238
3. **Check for Super-Palindromes:**
240-
241239
- Verify if the squared palindrome is also a palindrome.
242240

243241
4. **Count and Return:**

src/data/showcase/pull.png

2.32 MB
Loading

src/data/userData.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,5 +386,15 @@ export const Users: User[] = [
386386
website: "https://horse-ride-booking.vercel.app/",
387387
source: null,
388388
tags: ["opensource", "react", "redux", "motion", "javascript"],
389+
},
390+
//The Pull
391+
392+
{
393+
title: "The Pull",
394+
description: "Ecommerce wesbite template from where we can buy variety of shoes",
395+
preview: require("./showcase/pull.png"),
396+
website:"https://ridhima10.github.io/The_Pull/",
397+
source: "https://github.com/Ridhima10/The_Pull",
398+
tags: ["html", "css", "javascript"],
389399
}
390400
];

0 commit comments

Comments
 (0)