0% found this document useful (0 votes)
0 views

string

The document contains code snippets for converting integers to Roman numerals and vice versa, as well as reversing words in a string. It includes a function for calculating the maximum depth of nested parentheses. The code appears to be incomplete and contains several syntax errors.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

string

The document contains code snippets for converting integers to Roman numerals and vice versa, as well as reversing words in a string. It includes a function for calculating the maximum depth of nested parentheses. The code appears to be incomplete and contains several syntax errors.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

• c s z c s ac; z tt

, All! wa1 1w1tt wu.,.;;s:uicc;:;~


stati c vector <stri ng> sym{ "M'' , "CM''
, J
"D" ) '' CD'' ·•c · . :'(
I 1

stri ng intToRoman( i.nt num) {

stri.gn resul t = "'' ;


fDr (i nt i. = 0; i. <13 ; i++) { .

i.f(tlum == 0)
~break ;_

i. nt times = num/val[i.J;

'" while(times-- ) { . ,
result += sy~[i.J ;
}

num = num%val [i] ;I

}
l: I f!t4:W ,a ,t .+2 ht'::M
int romanToint (:st-ring ._ s') · {-

II
I
_.l,111~1· \ ~ ~ · · 1111
- ~ ' y~CJ~ itti:,:
. .,_ ·; '
. ' ,, . ' .. ~. .'
~-
, I
1
~ .~ f,J7st.<. f Bc~J ~tY(~ J ~'\:-~J()) f IR,, ~
_ .. __ 1,' lrr-~:-
A~:-~f"r' j'frf{ Jr /l It ~

i.nt i. = 0 ;
//hero honge hamare land r jo revrese karenge words ko
int l = 0 ,. r = 0;

int n• = s.length();

• J
whi.le(i < n) {
whi.lQ (i. < n && s[i.J != ' ') { Ii i. ko agar char di.kha to r ko dega and i.++ and r ++
s [I"++] = s [ i. ++] ;
}

i. f ( l •'.;t ~r}" f I 11 r
reverse(s.begi. n()+l, s.begi.n()+r);

s[r] = ' '.-


r++;

l = r;
}

1
i ++ ; fl y eto badht a rahega
}

s = s .substr(0 r -1);

return s;
class Solution {
public :
int maxDepth(string s)
stack<char> st:
i nt result.. =0:
for (char &ch ·:: s)
{
if (cti

_.-?;-
' :'. -
,. ...
.
. .. . - .
-~t
1: ...
' -- .•. ax( result, (int )st. size()):
,
} ' •.;·:
L
· ·re
~.c,
• • ,


.~ • : ' h~,

;
'••
·l ;;.,.
"
~
l •' ' -
~ View km

You might also like