Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 137c4e7

Browse files
Create 13-03-2024.cpp
1 parent 85533ee commit 137c4e7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎2024/03 - March/13-03-2024.cpp‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Author : Saransh Bangar
3+
Date : 13/03/2024
4+
Problem : Find the Pivot Integer
5+
Difficulty : Easy
6+
Problem Link : https://leetcode.com/problems/find-the-pivot-integer/description/
7+
Video Solution : NA
8+
*/
9+
10+
11+
class Solution {
12+
public:
13+
int pivotInteger(int n)
14+
{
15+
float ans1=sqrt((n*(n+1))/2);
16+
int ans2=int(ans1);
17+
if (ans1-ans2==0)
18+
return ans1;
19+
return -1;
20+
}
21+
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /