Skip to content

Instantly share code, notes, and snippets.

View sreedharmb's full-sized avatar

Sreedhar M B sreedharmb

  • Knolskape
  • Bangalore, India
View GitHub Profile
@naveenwashere
naveenwashere / FindingIfSubstring.java
Created January 13, 2014 18:21
Assume you have a method isSubstring which checks if one word is a substring of another. Given two string s1 and s2, write code to check if s2 is a roatation of sq using only one call ot isSubstring (eg., "waterbottle" is a rotation of "erbottlewat").
package com.interview.coding.crack;
public class FindingIfSubstring {
public boolean isSubstring(char a[], char b[])
{
int joint = 0;
int indexer = 0;
boolean flag = false;
if(a.length != b.length)
@naveenwashere
naveenwashere / RotateMatrixByOneEightyDegree
Created January 8, 2014 16:49
Rotate a Matrix by +180 degrees.
package com.interview.coding.crack;
public class RotateMatrixByOneEightyDegree {
public void rotateByOneEightyDegree(int[][] array, int m, int n)
{
for(int i = 0; i < ((m/2) + (m%2)); i++)
{
int first = i;
int last = n - 1;
@tempredirect
tempredirect / jquery.tooltip-remove.js
Created March 4, 2011 14:52
Hacky plugin to allow removal of the tooltips created by jquery tools tooltip
/**
* hacky plugin to allow removal of the jquery tools tooltip objects.
*
* Doesn't pay any attention to the special event configuration, and will blindly unbind all
* mouse[enter|leave] listeners from the trigger element.
*/
(function($){
var tooltip = $.fn.tooltip,
slice = Array.prototype.slice;