Skip to content

Instantly share code, notes, and snippets.

View anantham's full-sized avatar
🤓
Studying

Aditya Prasad anantham

🤓
Studying
View GitHub Profile
@anantham
anantham / CrossCharacter.java
Created June 22, 2018 08:48
Java solution to the CrossCharacter problem
// Cross character solution
import java.util.Scanner;
import java.util.ArrayList;
public class CrossCharacter {
public static void main(String[] a) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the number of test cases");
@anantham
anantham / puzzle.md
Created November 18, 2016 13:11
the origin of the question asked on math.stackexchange

Question 5

There is a set containing $1, 2, \cdots, 199$, we proceed to continuously select (at random) $2$ numbers ($a$ and $b$) then compute the number $c = (a+b+ab)$. We remove both $a$ and $b$ while we add $c$ to this set. Finally what will the final remaining number be?

Solution 5

The question seems to suggest that no matter which two numbers you choose, in every possible ordering, the final answer will be the same number. Lets generalize the question for integers $1, 2, \cdots, n$.

For $n=1$, the answer is $1$. For $n = 2$, the answer is $(1+2+2) = 5$. For $n = 3$, the first iteration yields $(5,3)$, $(11,1)$, or $(2,7)$. Which all lead to $23$.

Initially the sum of the $n$ numbers is $\frac{n(n+1)}{2}$. In each iteration we remove $a$ and $b$, decreasing the sum by $a$ and $b$ while we add $(a+b+ab)$.

@anantham
anantham / Linearization of Thermistor
Last active October 28, 2015 03:28
Industrial Instrumentation Mini Project
---
title: Industrial Instrumentation Mini Project
layout: Aside
published: true
tags: [Industrial Instrumentation, Mini Project, thermistor, simulation, Bosson's Law, linearization, time period, temperature ]
category: Industrial Instrumentation
---
##Industrial Instrumentation Mini Project
@anantham
anantham / hello world
Last active September 12, 2015 17:55
Hello World
hello world!
--------------
I am getting back to blogging after a kind of _sabbatical_,
lets get to learning and sharing.
I plan to use this post to test [MarkDown] [1] and [pagedown-extra] [2]
and also get familiar with StackEdit.
@anantham
anantham / pyInput.py
Created April 27, 2015 16:16
HackerRank - cheatsheet
# Method - 1 BRUTE FORCE
n = int(raw_input()) # number of test cases
N = [] # list of N's
for i in range(n):
N.append(int(raw_input()))
@anantham
anantham / Issue-1.md
Last active August 29, 2015 14:11
MotorIndia Issues

The 'batteries' section present in the main naviagetion drawer has only four articles

(this can be verified by visiting the website the image is here

of which the last 2 articles's image URL are being send by the server as

"/wp-content/uploads/2012/11/Pic-24-274x300.jpg" and "/wp-content/uploads/2012/10/TV-Ramanathan-Exide-copy-202x300.jpg"