This file contains hidden or 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
package main | |
import ( | |
"database/sql" | |
"fmt" | |
_ "github.com/lib/pq" | |
) | |
const ( |
This file contains hidden or 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<bits/stdc++.h> | |
using namespace std; | |
long long solve (string S) { | |
// Write your code here | |
long long mod=1000000007; //10^9+7 to prevent integer overflow | |
S = " "+S; | |
int freq[30]={0}; | |
for(int i=1;i<S.size();i++){ | |
freq[S[i]-'a']++; |
This file contains hidden or 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
package main | |
import "fmt" | |
// function to check if brackets are balanced | |
func isBalanced(expr string) bool { | |
brackets := map[rune]rune{ | |
'(': ')', | |
'[': ']', | |
'{': '}', |