
Recent Posts
Archives
 June 2017
 May 2017
 April 2017
 March 2017
 February 2017
 January 2017
 December 2016
 November 2016
 October 2016
 September 2016
 August 2016
 July 2016
 May 2016
 April 2016
 February 2015
 July 2014
 June 2014
 May 2014
 February 2014
 January 2014
 December 2013
 November 2013
 October 2013
 August 2013
 June 2013
 December 2012
 November 2012
Categories
Meta
Category Archives: LeetCode Solutions
Median of Two Sorted Arrays LeetCode
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n) ”’ Created on Jun 23, 2017 @author: asharda ”’ import numpy as … Continue reading
Posted in LeetCode Solutions, Uncategorized
Leave a comment
Reverse an Integer LeetCode
import java.util.ArrayList; import java.util.List; import org.testng.annotations.Test; /** * @author asharda * */ public class TestReverseInteger { @Test public void testReverseInteger() { int num=123; int div=num; int rem=0; List<Integer> list=new ArrayList<Integer>(); while(div>100) { div=num/10; rem=num%10; list.add(rem); } list.add(div%10); list.add(div/10); Integer [] … Continue reading
Posted in Uncategorized, Java, LeetCode Solutions
Leave a comment
Single Element in a Sorted Array
/** * Find Single Non Duplicate Element in Array. * @author asharda * */ public class Solution { public static void main(String[] args) { int []arr={3,4,5,3,4,5,6}; System.out.println(“Result is “+singleNonDuplicate(arr)); } /** * Find single Non Duplicate * @param nums * … Continue reading
Posted in Java, LeetCode Solutions
Leave a comment
Divide function
package tests; import org.testng.annotations.Test; /** * Divide without standard divison and using add. * @author asharda * */ public class DivisonTest { public int divide(int dividend,int divisor) throws Exception { int count=0; int temp=divisor; if((divisor ==0) && (dividend!=0)) { throw new … Continue reading
Posted in Java, LeetCode Solutions, Uncategorized
Leave a comment