Monthly Archives: November 2016

Using NUnit C#

For this first you need to download NUnit3 and NUnit3TestAdapter and add it to your references. using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using NUnit.Framework; namespace UnitTestProject1 { public class UnitTest3 { [Test] public void TestMethod1() { NUnit.Framework.Assert.IsTrue(true); } } } Advertisements

Posted in Uncategorized | 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

Default and Static Methods -Interface,Java

package tests; import org.testng.annotations.Test; interface Vehicle { default void model() { System.out.println(“This is the default Vehicle Version”); } static void parts() { System.out.println(“This are the default parts”); } } class Maruti implements Vehicle { public void model() { System.out.println(“This is … Continue reading

Posted in Uncategorized | Leave a comment

Lambda Expression -For Each Loop Java

package tests; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import org.testng.annotations.Test; public class LambdaExpressionTest { @Test public void testLambdaExpression() { List<Integer> list=new ArrayList<Integer>(); list.add(10); list.add(20); list.forEach(item->System.out.println(item)); } }

Posted in Uncategorized | Leave a comment

Letter Combinations of a Phone Number QuestionEditorial Solution–LeetCode

From LeetCode: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string “23” Output: [“ad”, “ae”, “af”, “bd”, “be”, … Continue reading

Posted in Uncategorized | Leave a comment

Delete a node from a LinkedList in Java

package tests; import org.testng.annotations.Test; class Node { int value; Node next; Node(int x) { value=x; } public void deleteNode(Node root,int n) { Node temp=root; while(temp!=null) { System.out.println(temp.value); if((!=null)&&( {; }; } } } public class DeleteNodeTest { @Test … Continue reading

Posted in Uncategorized | Leave a comment