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 np
x=np.array([1,2])
y=np.array([3,4])
mid=(np.dot(x,y)-1)/2
print “Mid is “,mid

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 [] arr=list.stream().toArray(Integer[]::new);
System.out.print(“Reversed Integer is “);
for (int val:arr)
{
System.out.print(val);
}

}
}

Posted in Java, LeetCode Solutions, Uncategorized | Leave a comment

Using Streams and Parallel Streams

 

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import org.testng.annotations.Test;

/**
* Test using Stream and Parallel Stream.
* @author asharda
*
*/
public class StreamTest {

@Test
public void testStreams()
{
List<Integer> list=new ArrayList<Integer>();
for(int i=0;i<100;i++)
{
list.add(i);
}
System.out.println(“Using Stream”);
Stream<Integer> s=list.stream();
s.forEach(System.out::println);
Stream<Integer>p=list.parallelStream();
System.out.println(“Using Parallel Stream”);
p.forEach(System.out::println);
}
}

Posted in Java, Uncategorized | Leave a comment

Run ExtentX on different host

http://extentreports.com/docs/extentx/#same-host

Posted in Uncategorized | Leave a comment

35 new English words

http://mentalfloss.com/article/31363/35-modern-words-recently-added-dictionary

Posted in Uncategorized | Leave a comment

Schedule a job every 55 mins in TeamCity

schedule_job

Image | Posted on by | Leave a comment

Testing with Paragraphs CSS

<!DOCTYPE html>
<html>
<head>
<meta charset=”ISO-8859-1″>
<title>CSS Paragraphs</title>
<style>
p.dot {border-style:dotted;}
p.double{border-style:double;}
</style>

</head>
<body>
<p class=”dot”> This is dotted paragraph</p>
<p class=”double”> This is double paragraph</p>
</body>
</html>

Posted in CSS, Uncategorized | Leave a comment