₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,288 members, 8,421,204 topics. Date: Friday, 05 June 2026 at 11:33 PM

Toggle theme

Termacs2's Posts

Nairaland ForumTermacs2's ProfileTermacs2's Posts

1 (of 1 pages)

ProgrammingRe: Come And Solve This Coding Problem by termacs2: 5:13pm On Nov 13, 2023
turmacs:
sad
Wetin 😂😂
ProgrammingRe: Come And Solve This Coding Problem by termacs2: 11:03am On Nov 13, 2023
Javascript

1 function smallestPussyNumber(pussyNumber, to = 919) {
2 let smallestPNumber = pussyNumber;
3 for (let i = pussyNumber; i <= to; i++) {
4 if (isPussyNumber(i) === i && isPussyNumber(i) >= smallestPNumber) {
5 smallestPNumber = i;
6 break;
7 }
8 }
9
10 return smallestPNumber;
11 }

🤣 The problem is really tricky. the tricky part for me is that line 6. If you like no put that break statement e go dey return the maximum constraint i.e 919, you have to loop it once!(speaking for my logic only).

Here is the function I used, him work na to return back the number if it's pussy/vaginaNumber.

1 function isPussyNumber(numberValue) {
2 let isPussyNumber = numberValue;
3 if (typeof numberValue !== 'number') {
4 return 'Go And Sit Down!';
5 }
6
7 // Handle The Constraint Gently 🥰
8 const isThreeDigit = `${numberValue}`.length == 3;
9
10 if (!isThreeDigit) {
11 return 'Pussy Number is Three Digit Number Only!';
12 }
13
14 // we need some methods from string or array. Let me use string.
15 const stringifiedDigit = `${numberValue}`;
16
17 const lastDigit = +(stringifiedDigit.slice(stringifiedDigit.length - 1, stringifiedDigit.length));
18
19 const firstTwoDigit = +(stringifiedDigit.slice(0, 2));
20
21 const productOfFirstTwo = (+stringifiedDigit.slice(0, 1)) * (+stringifiedDigit.slice(1, 2));
22
23 if (productOfFirstTwo !== lastDigit) {
24 isPussyNumber = false;
25 }
26
27 return isPussyNumber;
28 }

29 console.log(smallestPussyNumber(516));



The whole code without number lines.
function smallestPussyNumber(pussyNumber, to = 919) {
let smallestPNumber = pussyNumber
for (let i = pussyNumber; i <= to; i++) {
if (isPussyNumber(i) === i && isPussyNumber(i) >= smallestPNumber) {
smallestPNumber = i
break
}
}

return smallestPNumber
}

function isPussyNumber(numberValue) {
let isPussyNumber = numberValue
if (typeof numberValue !== 'number') {
return 'Go And Sit Down!'
}

// Handle The Constraint Gently 🥰
const isThreeDigit = `${numberValue}`.length == 3

if (!isThreeDigit) {
return 'Pussy Number is Three Digit Number Only!'
}

// we need some methods from string or array. Let me use string.
const stringifiedDigit = `${numberValue}`

const lastDigit = +(stringifiedDigit.slice(stringifiedDigit.length - 1, stringifiedDigit.length))

const firstTwoDigit = +(stringifiedDigit.slice(0, 2))

const productOfFirstTwo = (+stringifiedDigit.slice(0, 1)) * (+stringifiedDigit.slice(1, 2))

if (productOfFirstTwo !== lastDigit) {
isPussyNumber = false
}

return isPussyNumber
}
console.log(smallestPussyNumber(516))

1 (of 1 pages)