# Rahul Choudhary # Question 1: Prop Example ```javascript= <home variable ={'hello world'}/> function (props){ return ( <> <hr>{props.variable}</hr> </> ) } ``` # Question 2: Js ```javascript= const inputArr = [1, 2, 3, 2, 3, 1, 2, 4, 2, 3, 1, 2, 3] const result = { 1: 3, 2: 5, 3: 4, 4: 1 } function myfunc(inputArr){ const count ={}; let newArra = inputArr.map((item)=>{ count[item] = count[item] ? count[item]+1 :1; //console.log(count); }); return count; } ``` # Question 3: Bubble Sort ```java= // logic int arr[]={4,5,9,8,7,6}; int n = arr.length(); //logic for(int i=0; i<n; i++){ for(int j=0; j<n-i-1; j++){ if(arr[j]>arr[j+1]){ //swap int temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } for(int i=0; i<n; i++){ System.out.print(arr[i] +" "); } System.out.println(); ``` # Question 4: Find the max sum for continuous subarray in an array. i - [1, 2, -3, -4, 5, 3] - 8 - j 1+2=3 3+(-3)=0(old value == new value) agr value greter then h move next value and sum if (value less then then break the variable start new index) -4+5=1 1+3=4 sum =i+j check krege arr[i]<0 nhi h to j ko aage move krege next value sum and check krege previous value se agr privous value sum and new value sum greter then or less then greter then then--> move next value if less then then start again - //sum varable and start and end pointer -//loop run arr size sum krege arr[i] store krege - condition check krege - sum less then - variable me store = Integer.MIN_Value - if(variable < ) -