forked from AdarshAddee/Hacktoberfest2022_for_Beginers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AdarshAddee#29 from khushimarothi/cpp
Added code of C++
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//https://leetcode.com/problems/powx-n/ | ||
|
||
class Solution { | ||
public: | ||
double myPow(double x, int n) { | ||
double res=1; | ||
if (n == INT_MAX) | ||
return x; | ||
else if (n == INT_MIN) | ||
return (x == 1 || x == -1) ? 1 : 0; | ||
if(n<0) x=1/x, n*=-1; | ||
for(int i=1; i<=n;i++){ | ||
res=res*x; | ||
} | ||
return res; | ||
} | ||
}; | ||
|
||
//by - khushi marothi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
| Adarsh Addee | <a href="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/AdarshAddee">Adarsh Addee</a> | <a href="mailto:[email protected]">E-Mail</a> | | ||
| Sarthak Roy | <a href="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/sarthakroy2002">Sarthak Roy</a> | <a href="mailto:[email protected]">E-Mail</a> | | ||
| Suraj Bhandarkar S | <a href="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/Suraj-Bhandarkar-S">Adarsh Addee</a> | <a href="mailto:[email protected]">E-Mail</a> | | ||
| Khushi Marothi | <a href="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/khushimarothi">Khushi Marothi</a> | <a href="mailto:[email protected]">E-Mail</a> | | ||
| Aditya Giri | <a href="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/aditya-464">Aditya Giri</a> | <a href="mailto:[email protected]">E-Mail</a> | | ||
| KryPtoN | <a href="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/Kry9toN">Kry9toN</a> | <a href="mailto:[email protected]">E-Mail</a> | | ||
| Hardik Pratap Singh | <a href="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/hardik-pratap-singh">Hardik Pratap Singh</a> | <a href="mailto:[email protected]">E-Mail</a> | | ||
|
@@ -30,6 +31,7 @@ | |
|
||
|
||
|
||
|
||
<br> | ||
<h1> | ||
Happy Hacking ❤💻 | ||
|