|
1 | | -<!DOCTYPE html> |
2 | | -<html lang="en"> |
3 | | -<head> |
4 | | - <meta charset="UTF-8"> |
5 | | - <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
6 | | - <title>Shivarth Rai - CS Undergraduate</title> |
7 | | - <style> |
8 | | - * { |
9 | | - margin: 0; |
10 | | - padding: 0; |
11 | | - box-sizing: border-box; |
12 | | - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; |
13 | | - } |
14 | | - |
15 | | - body { |
16 | | - line-height: 1.6; |
17 | | - color: #333; |
18 | | - background-color: #f4f4f4; |
19 | | - } |
20 | | - |
21 | | - nav { |
22 | | - background-color: #2c3e50; |
23 | | - padding: 1rem; |
24 | | - position: fixed; |
25 | | - width: 100%; |
26 | | - top: 0; |
27 | | - } |
28 | | - |
29 | | - nav ul { |
30 | | - list-style: none; |
31 | | - display: flex; |
32 | | - justify-content: center; |
33 | | - gap: 2rem; |
34 | | - } |
| 1 | +class Solution { |
| 2 | +public: |
| 3 | + bool canBeValid(string s, string locked) { |
| 4 | + int n = s.length(); |
| 5 | + if(n % 2 == 1)return false; |
| 6 | + |
35 | 7 |
|
36 | | - nav a { |
37 | | - color: white; |
38 | | - text-decoration: none; |
39 | | - font-size: 1.1rem; |
40 | | - transition: color 0.3s; |
41 | | - } |
42 | | - |
43 | | - nav a:hover { |
44 | | - color: #3498db; |
45 | | - } |
46 | | - |
47 | | - .container { |
48 | | - max-width: 1200px; |
49 | | - margin: 80px auto 0; |
50 | | - padding: 2rem; |
51 | | - } |
52 | | - |
53 | | - .hero { |
54 | | - text-align: center; |
55 | | - padding: 4rem 0; |
56 | | - background-color: white; |
57 | | - border-radius: 10px; |
58 | | - box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); |
59 | | - margin-bottom: 2rem; |
60 | | - } |
| 8 | + stack<int> unl; |
| 9 | + stack<int> cl; |
61 | 10 |
|
62 | | - .hero h1 { |
63 | | - font-size: 2.5rem; |
64 | | - color: #2c3e50; |
65 | | - margin-bottom: 1rem; |
66 | | - } |
67 | | - |
68 | | - .hero p { |
69 | | - font-size: 1.2rem; |
70 | | - color: #7f8c8d; |
71 | | - } |
72 | | - |
73 | | - .about { |
74 | | - background-color: white; |
75 | | - padding: 2rem; |
76 | | - border-radius: 10px; |
77 | | - box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); |
78 | | - } |
79 | | - |
80 | | - .about h2 { |
81 | | - color: #2c3e50; |
82 | | - margin-bottom: 1rem; |
83 | | - } |
84 | | - |
85 | | - .skills { |
86 | | - margin-top: 2rem; |
87 | | - } |
88 | | - |
89 | | - .skills ul { |
90 | | - list-style: none; |
91 | | - display: grid; |
92 | | - grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); |
93 | | - gap: 1rem; |
94 | | - margin-top: 1rem; |
95 | | - } |
96 | | - |
97 | | - .skills li { |
98 | | - background-color: #3498db; |
99 | | - color: white; |
100 | | - padding: 0.5rem 1rem; |
101 | | - border-radius: 20px; |
102 | | - text-align: center; |
103 | | - } |
104 | 11 |
|
105 | | - .contact { |
106 | | - margin-top: 2rem; |
107 | | - text-align: center; |
| 12 | + for(int i = 0; i < n; i++) |
| 13 | + { |
| 14 | + if(locked[i] == 0) |
| 15 | + unl.push(i); |
| 16 | + else if(s[i] == '(') |
| 17 | + cl.push(i); |
| 18 | + else if(s[i] == ')') |
| 19 | + { |
| 20 | + if(!cl.empty()) |
| 21 | + cl.pop(); |
| 22 | + else if(!unl.empty()) |
| 23 | + unl.pop(); |
| 24 | + else { |
| 25 | + cout << "a" << endl; |
| 26 | + //return false; |
| 27 | + } |
| 28 | + } |
108 | 29 | } |
109 | 30 |
|
110 | | - .contact a { |
111 | | - display: inline-block; |
112 | | - padding: 0.8rem 1.5rem; |
113 | | - background-color: #2c3e50; |
114 | | - color: white; |
115 | | - text-decoration: none; |
116 | | - border-radius: 5px; |
117 | | - transition: background-color 0.3s; |
| 31 | + while(!cl.empty() && !unl.empty() && cl.top() < unl.top()){ |
| 32 | + cl.pop(); |
| 33 | + unl.pop(); |
| 34 | + |
118 | 35 | } |
119 | 36 |
|
120 | | - .contact a:hover { |
121 | | - background-color: #3498db; |
| 37 | + if(cl.empty() && !unl.empty()){ |
| 38 | + cout << "b" << endl; |
| 39 | + return (unl.size() % 2 == 0); |
122 | 40 | } |
123 | | - </style> |
124 | | -</head> |
125 | | -<body> |
126 | | - <nav> |
127 | | - <ul> |
128 | | - <li><a href="index.html">Home</a></li> |
129 | | - <li><a href="projects.html">Projects</a></li> |
130 | | - <li><a href="hobbies.html">Hobbies</a></li> |
131 | | - </ul> |
132 | | - </nav> |
133 | 41 |
|
134 | | - <div class="container"> |
135 | | - <div class="hero"> |
136 | | - <h1>Shivarth Rai</h1> |
137 | | - <p>Computer Science Undergraduate at MIT Manipal</p> |
138 | | - </div> |
| 42 | + cout << "c" << endl; |
| 43 | + return cl.empty(); |
139 | 44 |
|
140 | | - <div class="about"> |
141 | | - <h2>About Me</h2> |
142 | | - <p> |
143 | | - I am a passionate Computer Science student at Manipal Institute of Technology, |
144 | | - exploring various aspects of software development and technology. My interest |
145 | | - lies in building innovative solutions and learning new technologies. |
146 | | - </p> |
147 | 45 |
|
148 | | - <div class="skills"> |
149 | | - <h2>Technical Skills</h2> |
150 | | - <ul> |
151 | | - <li>Python</li> |
152 | | - <li>Java</li> |
153 | | - <li>C++</li> |
154 | | - <li>HTML/CSS</li> |
155 | | - <li>JavaScript</li> |
156 | | - <li>Data Structures</li> |
157 | | - </ul> |
158 | | - </div> |
159 | 46 |
|
160 | | - <div class="contact"> |
161 | | - <h2>Get in Touch</h2> |
162 | | - <a href=" mailto:[email protected]" >Email Me </a> |
163 | | - </div> |
164 | | - </div> |
165 | | - </div> |
166 | | -</body> |
167 | | -</html> |
| 47 | + } |
| 48 | +}; |
0 commit comments