Skip to content

Instantly share code, notes, and snippets.

@halitanildonmez
halitanildonmez / hemnet_scraper.py
Last active May 15, 2020 18:55
Parses a sold home link from hemnet.se and creates an sql script for parsing the data
from bs4 import BeautifulSoup
import urllib.request
def parse_html(soup_html, tag_name, class_name):
res = soup_html.find(tag_name, {"class": class_name})
return res.contents[0].strip()
hemnet_url = 'https://www.hemnet.se/salda/bostader?location_ids%5B%5D=18031&item_types%5B%5D=bostadsratt&sold_age=all'
req = urllib.request.Request(hemnet_url, headers={'User-Agent': 'Mozilla/5.0'})
fp = urllib.request.urlopen(req)
@halitanildonmez
halitanildonmez / google_plates_sol.java
Last active July 12, 2020 15:43
Solution for the Kickstart 2020 Round A solved as a practice version
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
Scanner sc =
new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int T = sc.nextInt();
@halitanildonmez
halitanildonmez / workout.java
Created July 20, 2020 21:12
Solution for Workout problem in Google Kickstart 2020 Round A
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int T = sc.nextInt();
@halitanildonmez
halitanildonmez / google_bundling_solution.cpp
Created August 31, 2020 20:27
Solution for google kickstart coding challenge for 2020
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
@halitanildonmez
halitanildonmez / google_bike_tour.java
Last active September 1, 2020 20:07
Solution for Bike Tour challenge on 2020 Kickstart round B
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int T = sc.nextInt();
@halitanildonmez
halitanildonmez / google_bus_routes.java
Created September 25, 2020 21:23
Solution for Google Bus Routes
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int T = sc.nextInt();
@halitanildonmez
halitanildonmez / google_robot_path_decoding.java
Created November 3, 2020 18:43
Solution for Robot Path Decoding Google Kickstart 2020
import java.util.*;
import java.io.*;
import java.util.regex.*;
import java.awt.*;
import java.awt.geom.*;
public class Solution {
public static String robotPathDecoder_Stack(String input) {
@halitanildonmez
halitanildonmez / advent_of_code_day_7.py
Last active December 16, 2020 17:34
Solution for Advent of Code Day 7 Challenge
def advent_day_seven_bag_content(statement):
so = statement.split(', ')
res = []
for s in so:
s = s.replace('bags', '').replace('bag', '').replace('.', '')
s = s.lstrip().rstrip()
if s != 'no other':
pair = (s[2:], s[0])
res.append(pair)
return res
@halitanildonmez
halitanildonmez / advent_of_code_day_8_solution.py
Created December 17, 2020 17:32
The solutions for day 8 of Advent of Code 2020
def advent_day_8_pt2_solver(instructions):
N = len(instructions)
index = 0
acc = 0
visited = []
candidates = []
while index < N:
if index in visited:
return acc, candidates, False
@halitanildonmez
halitanildonmez / advent_of_code_day_9.py
Created December 17, 2020 19:10
Solution for day 9 of 2020 advent of code
def advent_day_9_pt2(nums, sum_to_find):
N = len(nums)
for i in range(N):
conta_set = []
ts = nums[i]
conta_set.append(ts)
for k in range(i+1, N):
ts += nums[k]
conta_set.append(nums[k])