Skip to content

Instantly share code, notes, and snippets.

View raghavddps2's full-sized avatar
🎯
Focusing

Raghav Maheshwari raghavddps2

🎯
Focusing
View GitHub Profile
import java.util.*;
public class vowelBefore {
public static void main(String[] args) {
//Only lower case letters.
//Not a good solution, sliding window should be used but as 1 marks and a hurry, so can do
StringBuffer sb = new StringBuffer("nitin");
StringBuffer vowel = new StringBuffer();
StringBuffer consonent = new StringBuffer();
import java.util.*;
public class Ques1 {
static String OctToBin(String octnum)
{
long i = 0;
String binary = "";
while (i<octnum.length()) {
import java.util.*;
public class WordPuzzle {
public static void main(String[] args) {
int n = 3;
String s = "apple";
char grid[][] = {{'p','p','e'},{'l','a','d'},{'e','b','z'}};
System.out.println(exist(grid,s));
}
public static boolean exist(char[][] board, String word) {
int m = board.length;
@raghavddps2
raghavddps2 / BasicPythonRefresher.py
Created September 3, 2020 21:15
This is a Basic Python Referesher for someone who has worked with python a long time ago.
from functools import reduce
# Python Lists
a = [1,2,3,4,5]
a.append(10) # Adds to the list
a.remove(1) #removes the specified element
a.insert(1,20) #Inserts at specified index
len(a) #Gives the num of elements in teh array
a.pop() #Gives the last element of the array.
a.reverse() #reverses the array
a.sort() #Sorts the array in ascending order
import email
import getpass, imaplib
import os
import sys
import threading
import json
import time
import emoji
import pymysql
from twilio.twiml.messaging_response import MessagingResponse
from flask import Flask,request
app = Flask(__name__)
@app.route('/')
def hello():
review = request.args['review']
print(review)
response = {
"tags":["Open At Night","Bad Staff","Great to party"],
<html>
<head>
<title>My Farmers</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="./dash.css">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>
<body>
from sklearn.feature_selection import SelectKBest, chi2
X_new = SelectKBest(chi2, k=3).fit_transform(X,d)
X_new.shape
features_columns = df.columns
fs = SelectKBest(k=5)
fs.fit(X,d)
print((fs.get_support(),features_columns))
from sklearn.feature_selection import SelectKBest, chi2
X_new = SelectKBest(chi2, k=3).fit_transform(X,d)
X_new.shape
features_columns = df.columns
fs = SelectKBest(k=5)
fs.fit(X,d)
print((fs.get_support(),features_columns))
from sklearn.feature_selection import SelectKBest, chi2
X_new = SelectKBest(chi2, k=3).fit_transform(X,d)
X_new.shape
feature_1 = X_new[:,:1]
feature_2 = X_new[:,1:2]
feature_3 = X_new[:,2:3]
diagnosis = df['diagnosis'].to_numpy()