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
from collections import Counter | |
def algo(s): | |
if len(s) % 2 == 1: | |
return -1 | |
else: | |
a,b = s[:len(s)/2], s[len(s)/2:] | |
ca = Counter(a) | |
cb = Counter(b) |
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
from collections import Counter | |
def algo(a,b): | |
ca = Counter(a) | |
cb = Counter(b) | |
ct = Counter(a+b) | |
return sum(abs(ca[k] - cb[k]) for k in ct.keys()) | |
a, b = raw_input(), raw_input() |
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
i = raw_input() | |
print len(set.intersection(*[set(raw_input()) for n in range(int(i))])) |
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
from collections import Counter | |
def algo(s): | |
v = len(filter(lambda x: x % 2 == 1, Counter(s).values())) | |
if v <=1: | |
return True | |
else: | |
return False | |
string = raw_input() |
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
from itertools import groupby | |
import operator | |
def algo(string): | |
s = list(string) | |
g = sum(len(list(v)) -1 for (k,v) in groupby(s, key=operator.itemgetter(0))) | |
return g | |
num = raw_input() |
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
#! python3 | |
import requests | |
import sys | |
# replace these with configData | |
tableauServer = 'http://localhost/' | |
tableauUsername = 'Robin' | |
workbookView = 'WorldIndicators/GDPpercapita' | |
workbookView2 = 'WorldIndicators/Countryranks' | |
worksheetSuffix = '.csv' |
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 object mail { | |
implicit def stringToSeq(single: String): Seq[String] = Seq(single) | |
implicit def liftToOption[T](t: T): Option[T] = Some(t) | |
sealed abstract class MailType | |
case object Plain extends MailType | |
case object Rich extends MailType | |
case object MultiPart extends MailType |
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
Hi All, | |
Running on Linux is actually pretty simple. The hardest part is that you do need to be able to run either the server installer or the tabcmd installer to get the tabcmd jars. But after you do that, here are the instructions: | |
1) Create a local copy of C:\Program Files\Tableau\Tableau Server\9.0\extras\lib to $HOME/lib. | |
2) Create a ~/.tabcmd directory. This is used for logs, session storage and file uploads. | |
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
import org.apache.spark.rdd.JdbcRDD | |
import java.sql.{Connection, DriverManager, ResultSet} | |
classOf[com.vertica.jdbc.Driver] | |
println("com.vertica.jdbc.Driver loaded successfully ") | |
val conn_str = "jdbc:vertica://172.16.251.171:5433/analyticsdb?user=dbadmin&password=analytics" | |
// val conn = DriverManager.getConnection(conn_str) | |
println("Connection with vertica established ") |
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
import Control.Monad | |
import Control.Arrow | |
isPalandrome :: [String] -> Bool | |
isPalandrome = reverse >>= (==) | |
process :: String -> Bool | |
process s = isPalandrome (take n t) | |
where (h,t) = (head &&& tail) $ lines s | |
n = read h :: Int |