Skip to content

Instantly share code, notes, and snippets.

View caglarorhan's full-sized avatar
🤿
diving to the codes :)

Çağlar ORHAN caglarorhan

🤿
diving to the codes :)
View GitHub Profile
@caglarorhan
caglarorhan / between_two_sets.js
Created January 28, 2018 22:16
Between Two Sets - A fraction problem (from hackerrank.com)
/*
Original URL: https://www.hackerrank.com/challenges/between-two-sets/problem
Consider two sets of positive integers, and . We say that a positive integer, , is between sets and if the following conditions are satisfied:
All elements in are factors of .
is a factor of all elements in .
In other words, some is between and if that value of satisfies for every in and also satisfies for every in . For example, if and , then our possible values are and .
Given and , find and print the number of integers (i.e., possible 's) that are between the two sets.
@caglarorhan
caglarorhan / htmlParser.vbs
Created January 29, 2018 22:14
VBScript - Google Search Parser and Insert into MSSQL
aramaSeti="araba,bal�k,ferrari,jeton,kelaynak"
' aranacak kelimeler �nce url tipi karakterler ta��mal� TR karakterler ve bo�luklar �evrilmeli
linkTemelAdresi ="http://news.google.com/news/search?pz=1&cf=all&ned=tr_tr&hl=tr&q="
arananlar = split(aramaSeti,",")
For araNo=0 to UBound(arananlar)-1
Dim objHttp
Set objHttp = CreateObject("Msxml2.ServerXMLHTTP")
objHttp.Open "GET", linkTemelAdresi & arananlar(araNo), False
msgbox(linkTemelAdresi & arananlar(araNo))
@caglarorhan
caglarorhan / twoSum
Created February 2, 2018 14:08
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same element twice.
/**
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
Example:
Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
@caglarorhan
caglarorhan / validParentheses.js
Created February 2, 2018 14:10
Valid Parentheses -from leetcode.com
var isValid = function(s) {
var rV=true; // default
var f='';
for(var x=0; x<s.length; x++){
if('()[]{}'.indexOf(s[x])>-1){
f+=s[x];
}
}
while((f.indexOf('[]')>=0) || (f.indexOf('()')>=0) || (f.indexOf('{}')>=0)){
f=f.replace('[]','');f=f.replace('()','');f=f.replace('{}','');
@caglarorhan
caglarorhan / WarmerTemperature-DistanceOfDay
Last active February 2, 2018 21:02
WarmerTemperature-DistanceOfDay
/**
* @param {number[]} temperatures
* @return {number[]}
*/
var dailyTemperatures = function(temperatures) {
let outPut = [];
//let test=[];
const howMany = temperatures.length;
temperatures.forEach(function(i,index){
@caglarorhan
caglarorhan / nextGreaterElement_1.js
Created February 2, 2018 21:55
496. Next Greater Element I -From leetcode
/**
* @param {number[]} findNums
* @param {number[]} nums
* @return {number[]}
*/
var nextGreaterElement = function(findNums, nums) {
const fNLength = findNums.length;
const nLength = nums.length;
let outPut = [];
@caglarorhan
caglarorhan / withoutOperators.js
Last active February 4, 2018 21:50
Addition and Subtraction Without Operators in Javascript
function dec2bin(dec){
"use strict";
return dec.toString(2);
}
function bin2dec(bin){
"use strict";
return parseInt(bin,2);
}
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
@caglarorhan
caglarorhan / 2DArray_DS.js
Created February 11, 2018 12:10
2D Array - DS - Hourglass in A Array problem from - https://www.hackerrank.com/challenges/2d-array/problem
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});