Skip to content

Instantly share code, notes, and snippets.

View AnwarShahriar's full-sized avatar
🎱
Focusing

Md. Shahriar Anwar AnwarShahriar

🎱
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am anwarshahriar on github.
  • I am noob88 (https://keybase.io/noob88) on keybase.
  • I have a public key ASDLM7t0UKezVlhF5JFugKZeM4EQjo5DYDPPMBtkGl7LHQo

To claim this, I am signing this object:

@AnwarShahriar
AnwarShahriar / coordinator_scroll_sandwich.xml
Created August 14, 2019 04:11
Coordinator layout test with multiple static view and one scrollable header in between.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/topBar"
android:layout_width="match_parent"
@AnwarShahriar
AnwarShahriar / MainActivity.kt
Created June 2, 2019 08:47
Image View size manipulation and conditional image loading with glide
package me.anwarshahriar.bitmapwithglide
import android.content.Context
import android.graphics.BitmapFactory
import android.os.Bundle
import android.util.DisplayMetrics
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
@AnwarShahriar
AnwarShahriar / description.md
Created May 6, 2019 13:34 — forked from dmytrodanylyk/description.md
Where this dependency comes from?

Did you ever have android build failed​ issue because of dependency resolution?

… or you were curious where all these old rxjava dependencies come from?

You can pretty easy track the module causing issues via following gradle command.

gradlew :root-module:dependencyInsight \
--configuration debugRuntimeClasspath \ // or debugCompileClasspath
--dependency io.reactivex:rxjava:1.1.0 &gt; dependencies.txt // saves result to 'dependencies.txt' file
@AnwarShahriar
AnwarShahriar / contiguous-sum.js
Created July 8, 2018 19:08
Maximum sum subarray
function findMaxSum(arr) {
let highestSum = 0
let nextSum = 0
for (let i = 0; i < arr.length; i++) {
nextSum = 0
for (let j = i; j < arr.length; j++) {
nextSum += arr[j]
if (nextSum > highestSum) {
highestSum = nextSum
@AnwarShahriar
AnwarShahriar / NumRange.java
Last active January 29, 2018 10:50
A solution to numrange problem. Problem description and sample input is given with the solution.
/**
Given an array of non negative integers A, and a range (B, C),
find the number of continuous subsequences in the array which have sum S in the range [B, C] or B <= S <= C
Continuous subsequence is defined as all the numbers A[i], A[i + 1], .... A[j]
where 0 <= i <= j < size(A)
Input Description:
First line contains the number of inputs preceding with total number of input
Second line contains B lower range of sum (inclusive)
function merge(a, b) {
let i = 0;
let j = 0;
let k = 0;
let arr = [];
while (i < a.length && j < b.length) {
if (a[i] <= b[j]) {
arr[k] = a[i];
i++;
} else {
@AnwarShahriar
AnwarShahriar / naive_bigint_impl.js
Created July 20, 2017 13:18
This implements big integer addition in a naive way
let x = '12345678901234567890';
let y = '12345678901234567890';
let maxLen = Math.max(x.length, y.length)
if (maxLen !== x.length) {
let tempX = y;
y = x;
x = tempX;
}
@AnwarShahriar
AnwarShahriar / The Technical Interview Cheat Sheet.md
Last active June 3, 2017 08:39 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

Array

Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
-module(practice).
-export([join/2, concat/1, member/2]).
join([],Y) -> Y;
join([X|Xs], [Y|Ys]) ->
[X|join(Xs, [Y|Ys])].
concat([X]) -> X;
concat([X|Xs]) ->
join(X, concat(Xs)).