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
using System; | |
namespace LeetCode8 | |
{ | |
public class Solution { | |
public int MyAtoi(string s) { | |
int n = s.Length; | |
bool isPositive = true; | |
int i; | |
for(i = 0 ; i < n;++i){ |
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
#include <iostream> | |
#include <cstdlib> | |
using namespace std; | |
class Solution { | |
public: | |
int myAtoi(string s) { | |
int n = s.length(); | |
bool isPositive = true; | |
int i; |
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
using System; | |
namespace LeetCode125 | |
{ | |
public class Solution { | |
private int GetAlphanumericCommonIndex(char c){ | |
int index; | |
if(c >= 'a' && c <= 'z'){ | |
index = c - 'a'; | |
} |
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
#include <iostream> | |
using namespace std; | |
class Solution { | |
private: | |
int getAlphanumericCommonIndex(char c){ | |
int index; | |
if(c >= 'a' && c <= 'z'){ | |
index = c - 'a'; | |
} |
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
using System; | |
using System.Collections.Generic; | |
namespace LeetCode242 | |
{ | |
public class Solution { | |
public bool IsAnagram(string s, string t) { | |
List<int> sCheck = new List<int>(); | |
List<int> tCheck = new List<int>(); | |
for(int i = 0 ; i < 26;++i){ |
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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
class Solution { | |
public: | |
bool isAnagram(string s, string t) { | |
vector<int> sCheck(26); | |
vector<int> tCheck(26); | |
for(int i = 0 ; i < s.length();++i){ |
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
using System; | |
using System.Collections.Generic; | |
namespace LeetCode387 | |
{ | |
public class Solution { | |
public int FirstUniqChar(string s) { | |
List<List<int>> checkChars = new List<List<int>>(); | |
for(int i = 0 ; i < 26;++i){ | |
checkChars.Add(new List<int>()); | |
} |
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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
class Solution { | |
public: | |
int firstUniqChar(string s) { | |
vector<vector<int>> checkChars(26); | |
for(int i = 0 ; i < s.length();++i){ | |
checkChars[s[i] - 'a'].push_back(i); |
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
using System; | |
namespace LeetCode7 | |
{ | |
public class Solution { | |
public int Reverse(int x) { | |
long ans = 0; | |
while(x != 0){ | |
ans = ans * 10 + (x % 10); | |
x /= 10; |
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
#include <iostream> | |
#include <cmath> | |
#include <climits> | |
using namespace std; | |
class Solution { | |
public: | |
int reverse(int x) { | |
long ans = 0; | |
while(x != 0){ |
NewerOlder