This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function() { | |
| $('.tour').on('click','button',function() { | |
| var tour = $(this).closest('.tour'); | |
| var discount = tour.data('discount'); | |
| var message = $('<span>Call 1-555-jquery-air for a $' + discount + ' discount.</span>'); | |
| tour.append(message); | |
| $(this).remove(); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('button').on('click', function() { | |
| var tour = $(this).closest('.tour'); | |
| var discount = tour.data('discount'); | |
| var message = $('<span>Call 1-555-jquery-air for a $' + discount + ' discount.</span>'); | |
| tour.append(message); | |
| $(this).remove(); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function() { | |
| $('button').on('click', function() { | |
| var message = $('<span>Call 1-555-jquery-air to book this tour</span>'); | |
| $('.usa').append(message); | |
| $('button').remove(); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.tvidushi.string.skipletter; | |
| public class PermuteString { | |
| private static void permute(String prefix, String s){ | |
| System.out.print("["+s+"] ,"); | |
| int n=s.length(); | |
| if (n==0){ | |
| //System.out.println("-------------------------------"+prefix); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package linkList; | |
| import java.util.*; | |
| /* | |
| * we are using linked list with hashmap for Lru. | |
| * Reason behind this is ,since HashMap is able to store data and key but | |
| * how do we get info about least recently used cache value?. For this we need to keep track all inserted data into map | |
| * by using linked list. When inserting new values , add this value to the top of linked list. When key,value is already |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Duplicates are not allowed in arr. | |
| */ | |
| public int search(int arr[],int search){ | |
| int low =0; | |
| int high = arr.length-1; | |
| while(low <= high){ | |
| int mid = (low + high)/2; | |
| if(arr[mid] == search){ | |
| return mid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Arrays; | |
| /** | |
| * http://www.geeksforgeeks.org/count-pairs-difference-equal-k/ | |
| * | |
| * Count all distinct pairs with difference equal to k | |
| 2.6 | |
| Given an integer array and a positive integer k, count all distinct pairs with difference equal to k. | |
| Examples: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.interview.binarysearch; | |
| /** | |
| * missing no in arithmetic progression | |
| * http://www.careercup.com/question?id=4798365246160896 | |
| */ | |
| public class ArithmeticProgressionSearch { | |
| public int search(int input[]){ | |
| int low =0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.tvidushi.arrays; | |
| import java.util.stream.Stream; | |
| /** | |
| * An Array element is considered peaj ,if it is not | |
| * smaller than its neigbours | |
| */ | |
| public class PeakElement { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FirstOccurrenceOfNumberInSortedArray { | |
| public int firstOccurrence(int input[], int x){ | |
| int low = 0; | |
| int high = input.length-1; | |
| while(low <= high){ | |
| int middle = (low + high)/2; | |
| if(input[middle] == x && (middle == 0 || input[middle-1] < x)){ | |
| // if(input[middle] == x){ |
NewerOlder