Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,753 members, 7,817,083 topics. Date: Saturday, 04 May 2024 at 03:57 AM

Come And Solve This Coding Problem - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Come And Solve This Coding Problem (870 Views)

A "Senior" Software Developer Could Not Solve This Coding Challenge, Can You? / Backend Coding Problem / Daily Coding Problem (2) (3) (4)

(1) (Reply) (Go Down)

Come And Solve This Coding Problem by turmacs(f): 9:20am On Nov 03, 2023
A Vagina number is a three-digit number where the last digit is a product of the first and second digit

e.g 122,100,224 are Vagina numbers, while 287,473,112 are not Vagina numbers

You're given a three digit number N, find the smallest Vagina number that is greater than or equal to N. It always exists under the constraints.

Constraints
100ā‰¤Nā‰¤919
N is positive

Sample Input 01
320
Sample Output 01
326


Sample Input 02
144
Sample Output 02
144


Sample Input 03
516
Sample Output 03
600

3 Likes

Re: Come And Solve This Coding Problem by turmacs(f): 9:26am On Nov 03, 2023
If you can't solve this simple problem without ChatGpt, please consider a change of career path

2 Likes

Re: Come And Solve This Coding Problem by koladata(m): 10:49am On Nov 03, 2023
i can solve it , but how much ?
Re: Come And Solve This Coding Problem by turmacs(f): 10:52am On Nov 03, 2023
koladata:
i can solve it , but how much ?
Mthewww. I wonder what made you think I can't solve it myself, nonsense. How much kill you there, nonsense. Broke men everywhere, i spit on your bald head
Re: Come And Solve This Coding Problem by koladata(m): 11:24am On Nov 03, 2023
i'm not broke, I just wanted to be sure of the need for it
turmacs:
Mthewww. I wonder what made you think I can't solve it myself, nonsense. How much kill you there, nonsense. Broke men everywhere, i spit on your bald head
Re: Come And Solve This Coding Problem by turmacs(f): 11:47am On Nov 03, 2023
koladata:
i'm not broke, I just wanted to be sure of the need for it
šŸ˜’
Re: Come And Solve This Coding Problem by turmacs(f): 12:46pm On Nov 03, 2023
So nobody can solve this? Wonderful
Re: Come And Solve This Coding Problem by Possessedkid: 1:12pm On Nov 03, 2023
Solve it by yourself ijiot

2 Likes

Re: Come And Solve This Coding Problem by ibo(m): 5:07pm On Nov 03, 2023
turmacs:
A Vagina number is a three-digit number where the last digit is a product of the first and second digit

e.g 122,100,224 are Vagina numbers, while 287,473,112 are not Vagina numbers

You're given a three digit number N, find the smallest Vagina number that is greater than or equal to N. It always exists under the constraints.

Constraints
100ā‰¤Nā‰¤919
N is positive

Sample Input 01
320
Sample Output 01
326


Sample Input 02
144
Sample Output 02
144


Sample Input 03
516
Sample Output 03
600

Just come out and say it's your homework and I will give you the solution and the walk through.
This is an exercise for students taking DSA
Re: Come And Solve This Coding Problem by turmacs(f): 10:44am On Nov 04, 2023
ibo:


Just come out and say it's your homework and I will give you the solution and the walk through.
This is an exercise for students taking DSA
No be only DSA
Re: Come And Solve This Coding Problem by turmacs(f): 10:47am On Nov 04, 2023
Since nobody could solve it yet, I'll drop my own solution

C++

 #include <bits/stdc++.h>
using namespace std;
int likeNUMBER(int n ){
vector<int> a;
while(n>0){
int digit = n%10;
a.push_back(digit);
n/=10;
}
reverse(a.begin(), a.end());
int q = a.size();
int product = 1;
for(int i = 0; i <q-1;i++){
product *= a[i];
}
if(product != a[q-1]){
return false;
}
return true;
}

int main( ){
int n; cin >>n;
int num;
for(int i = n;i<919; i++){
if(likeNUMBER(i)){
num = i;
break;
}
}
cout << num << endl;
return 0;
}
Re: Come And Solve This Coding Problem by LikeAking: 10:21pm On Nov 04, 2023
turmacs:
Since nobody could solve it yet, I'll drop my own solution

C++

 #include <bits/stdc++.h>
using namespace std;
int likeNUMBER(int n ){
vector<int> a;
while(n>0){
int digit = n%10;
a.push_back(digit);
n/=10;
}
reverse(a.begin(), a.end());
int q = a.size();
int product = 1;
for(int i = 0; i <q-1;i++){
product *= a[i];
}
if(product != a[q-1]){
return false;
}
return true;
}

int main( ){
int n; cin >>n;
int num;
for(int i = n;i<919; i++){
if(likeNUMBER(i)){
num = i;
break;
}
}
cout << num << endl;
return 0;
}

Nice!
Re: Come And Solve This Coding Problem by BlackhatMentor: 2:36am On Nov 05, 2023
turmacs:
Since nobody could solve it yet, I'll drop my own solution

C++

 #include <bits/stdc++.h>
using namespace std;
int likeNUMBER(int n ){
vector<int> a;
while(n>0){
int digit = n%10;
a.push_back(digit);
n/=10;
}
reverse(a.begin(), a.end());
int q = a.size();
int product = 1;
for(int i = 0; i <q-1;i++){
product *= a[i];
}
if(product != a[q-1]){
return false;
}
return true;
}

int main( ){
int n; cin >>n;
int num;
for(int i = n;i<919; i++){
if(likeNUMBER(i)){
num = i;
break;
}
}
cout << num << endl;
return 0;
}

FriedPussy šŸ˜
Re: Come And Solve This Coding Problem by BlackhatMentor: 2:41am On Nov 05, 2023
turmacs:
A Vagina number is a three-digit number where the last digit is a product of the first and second digit

e.g 122,100,224 are Vagina numbers, while 287,473,112 are not Vagina numbers

You're given a three digit number N, find the smallest Vagina number that is greater than or equal to N. It always exists under the constraints.

Constraints
100ā‰¤Nā‰¤919
N is positive

Sample Input 01
320
Sample Output 01
326


Sample Input 02
144
Sample Output 02
144


Sample Input 03
516
Sample Output 03
600



From your definition of vagina number is this not wrong?

5*1 is = 5

Output should be 605
Re: Come And Solve This Coding Problem by turmacs(f): 4:00am On Nov 05, 2023
BlackhatMentor:
[/i]


From your definition of vagina number is this not wrong?

5*1 is = 5

Output should be 605
6 X 0 is not 5
Re: Come And Solve This Coding Problem by BlackhatMentor: 4:54am On Nov 05, 2023
turmacs:
6 X 0 is not 5

That's the output.

Check the input
Re: Come And Solve This Coding Problem by Najdorf: 6:25am On Nov 05, 2023
BlackhatMentor:


That's the output.

Check the input
Reread the problem
Re: Come And Solve This Coding Problem by SenecaTheYonger: 12:52pm On Nov 05, 2023
Are you telling me this romanceland troll has brain?
Re: 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))
Re: Come And Solve This Coding Problem by turmacs(f): 1:28pm On Nov 13, 2023
termacs2:
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))
sad
Re: Come And Solve This Coding Problem by termacs2: 5:13pm On Nov 13, 2023
turmacs:
sad

Wetin šŸ˜‚šŸ˜‚
Re: Come And Solve This Coding Problem by MindOnMatters00(m): 2:08am On Nov 14, 2023
termacs2:

Wetin šŸ˜‚šŸ˜‚

Na u go dey reply person wey get empty brain.
Re: Come And Solve This Coding Problem by niel63(m): 2:14am On Nov 14, 2023
A word of advice. Start building out projects, stop sexualizing programming challenges.

The real challenge is in system design. Make your product no work first. You go know what's up.

Pussy this, dick that, toto this, breast that. Come on! undecided

1 Like

Re: Come And Solve This Coding Problem by Walebaruwa: 4:03pm On Nov 16, 2023
// Vag Number Checker fuction
function isVagNo(x) {
return (
Number(x.toString()[0]) * Number(x.toString()[1]) ===
Number(x.toString()[2])
);
}

// Implementation
function vagNo(num) {
// Return nothing if Constraints are not met
if (num.toString().length < 3 || num < 100 || num > 919) return;

// Return num if num passes as a Vag Number
if (isVagNo(num)) {
console.log(num);
return num;
} else {
// Else loop through with num as the lower range and 919 as the Upper range till the nearest Vag no is found.
for (let i = num; i <= 919; i++) {
if (isVagNo(i)) {
console.log(i);
return i;
}
}
}
}
// Test cases

vagNo(320);
vagNo(144);
vagNo(516);

(1) (Reply)

Sudoku Puzzle / Creat Autorun Cd Yor Self / How To Install Oracle On Linux?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 49
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.