Author Archives: qainterviews

About qainterviews

Software Geek,QA Expert,Blogger

Climbing Stairs

https://leetcode.com/problems/climbing-stairs/discuss/155645/Jave-Soulution package test4; /** * ClimbingStairs Problem * @author asharda * */ public class ClimbingStairs { public static void main(String[] args) { ClimbingStairs s=new ClimbingStairs(); System.out.println(s.climbStairs(4)); //s.climbStairs(4); } public int climbStairs(int n) { int result = 1, temp; int a … Continue reading

Posted in Uncategorized | Leave a comment

Dequeue in Python

”’ Created on Aug 11, 2018 @author: asharda ”’ import collections deq=collections.deque([“Mon”,”Tue”,”Wed”]) deq.append(“Thu”) deq.appendleft(“Sun”) print(deq) deq.pop() print(deq) deq.reverse() print(deq)

Posted in Uncategorized | Leave a comment

LinkedLists in Python

”’ Created on Aug 3, 2018 @author: asharda ”’ class node: def __init__(self,data=None): self.data=data self.nextVal=None n1=node(1) n2=node(2) n3=node(3) n1.nextVal=n2 n2.nextVal=n3 t1=n1 while t1: print(t1.data) t1=t1.nextVal

Posted in Python, Uncategorized | Leave a comment

Using sets in Python

”’ Created on Aug 3, 2018 @author: asharda ”’ days=set([“Mon”,”Tue”,”Wed”,”Thu”,”Fri”]) daysA=set([“Tue”,”Wed”,”Thu”,”Fri”]) print(days-daysA) print(days & daysA) for d in days: print(d) days.add(“Sun”)

Posted in Python, Uncategorized | Leave a comment

Excellent Recursion Article

Posted in Uncategorized | Leave a comment

Rotate Array

/**Program to rotate array * @author asharda * */ public class RotateArray { /** * @param args */ public static void main(String[] args) { RotateArray r =new RotateArray(); int arr[]= {1,2,3,4,5,6,7}; int b[]=r.rotateArray(arr,2); for(int i:b) { System.out.println(i); } } /** … Continue reading

Posted in Data Structures, Java, Java 8 | Leave a comment

Different Array Operations in Python

”’ Created on Jul 25, 2018 @author: asharda ”’ import array def printArr(arr): for i in range(0,len(arr)): print(arr[i]) arr=array.array(‘i’,[1,2,3,4]) #print(arr) printArr(arr) print(“After Reverse”) arr.reverse() printArr(arr) print(“After Append”) arr.reverse() arr.append(5) printArr(arr) print(“After Insert”) arr.insert(0, 0) printArr(arr)

Posted in Python, Uncategorized | Tagged | Leave a comment