Sitemap
Paul.H

Paul.H

hello😉😉

My First article

Apr 10, 2023

--

Edit at 10/4/2023

A doggo

Press enter or click to view image in full size
Her name is Momo

Get Paul.H’s stories in your inbox

Join Medium for free to get updates from this writer.

A bird image template from Unsplash

Press enter or click to view image in full size
Photo by Zdeněk Macháček on Unsplash

The first video of Mr.Beast

Mr.Beast’s first video

Leetcode 13: Roman to Integer

int romanToInt(char * s){
int i=0;
int ans=0;

while(*(s+i) != '\0'){
if(*(s+i)=='I'){
if(*(s+i+1)=='V'){
ans= ans+4;
i++;
}else if(*(s+i+1)=='X'){
ans= ans+9;
i++;
}else{
ans++;
}
}else if(*(s+i)=='V'){
ans+=5;
}else if(*(s+i)=='X'){
if(*(s+i+1)=='L'){
ans= ans+40;
i++;
}else if(*(s+i+1)=='C'){
ans= ans+90;
i++;
}else{
ans+=10;
}
}else if(*(s+i)=='L'){
ans+=50;
}else if(*(s+i)=='C'){
if(*(s+i+1)=='D'){
ans= ans+400;
i++;
}else if(*(s+i+1)=='M'){
ans= ans+900;
i++;
}else{
ans+=100;
}
}else if(*(s+i)=='D'){
ans+=500;
}else if(*(s+i)=='M'){
ans+=1000;
}
i++;
}
return ans;
}

— — — — — — — — — — — — — — End of this test article — — — — — — — — — — — —

--

--