Hi everyone

I may have done mistakes. Maybe writing stuff in this blog is also a mistake I don’t know about that but I did what I did and if it is wrong then I am responsible for that.
Hope my mistakes never hurt anyone. I don’t like to hurt people but that’s not my weakness I hurt those who deserve that but I am not sure if they deserve it or not so I am sorry, if possible forgive me.

ok now let’s get back to the actual thing why I am writing this. today October 2nd 2021.
From now on I like to write and be accountable to my actions.
I bought a ssd for my laptop. luckily without any mistake I installed it into my laptop and cloned my windows.

Now I am writing this because I have time and my laptop is fast.


the above one is the one I bought. it is good. there are many options but this is affordable one and good.

There are even faster ones u can choose at your price.

Ok first to upgrade check you laptop supports ssd or not and it has a m.2 slot or not then only but.

thanks for reading Human.

Realization

Every app is playing with dopamine effect. It’s time I get rid of scrolling the apps.
Now I want to learn new things and build new things.

Every one stop scrolling unless u really got free time and your successful already if not use the time to be successful in your work. Learn new techniques learn new things. Don’t just keep scrolling things and waste time. If you got free time then u can do it but when I mean free time u have to be completely satisfied with your way of leaving already and u don’t want any improvement. If you want improvement stop scrolling and start reading writing learning and don’t forget to do exercise.

Hi today we started to win a big war!

First day we won the game we are in lead.

Now
Today problems learning Outcomes:

  1. now we know how to take input as given in question (from 1st question).
  2. We know how to store the taken input in arrays.
  3. We know how to use Integer.parseInt() function.
  4. We learned how to apply logic like adding elements and storing in new array.

we use Integer.parseInt(value); here value can be string or float or long any datatype.

we use Stirng[] arr= str.split(” “) function to split a string.

we use int[] arr=new int[]{31,2,31,23,12}; to create new arry of int.
or we use int[] arr=new int[size]; to declare array of size size;

Problem 1

 

Given an integer array A of size N, find sum of elements in it. Input: First line contains an integer denoting the test cases 'T'. T testcases follow. Each testcase contains two lines of input. First line contains N the size of the array A. The second line contains the elements of the array. Output: For each testcase, print the sum of all elements of the array in separate line.

Input Format

Input:
2
3
3 2 1
4
1 2 3 4

Constraints

Constraints:4
1 <= T <= 100
1<= N<= 100
1 <= Ai <= 100

Output Format

Output:
6
10

Solution

import java.util.Scanner;
public class validate {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner iv=new Scanner(System.in);
int k=Integer.parseInt(iv.nextLine());
int result[]=new int[k];
for(int i=0;i<k;i++) {
   int temp=Integer.parseInt(iv.nextLine());
   String[] arr=iv.nextLine().split(” “);
   int total=0;
   for(int j=0;j<temp;j++) {
   total+=Integer.parseInt(arr[j]);
   }
   result[i]=total;
}
for(int i=0;i<k;i++) {
System.out.println(result[i]);
}
}

Problem 2: Triangles can be formed or not from a input array.

int[] canMakeTrinagle(int[] arr){
int[] finalop=new int[arr.length-2];
for(int i=0;i<arr.length-2;i++){

if(arr[i]+arr[i+1]>arr[i+2] && arr[i+2]+arr[i+1]>arr[i] && arr[i+2]+arr[i]>arr[i+1]){
finalop[i]=1;
}
else{
finalop[i]=0;
}
}
return finalop;
}

← Back

Thank you for your response. ✨

9th May 2021 My story don’t read if not interested!

I was suppose to update a APP by now. But Not even started working on it.
It was an important think that should be done. It was a APP of my friend. She never asked but I know she will never ask but I will feel bad that I couldn’t make it.

I got some other work and relatives around so I was not able to do it. Now I should try to cover it by tomorrow.
Morning I will wake up and do it by 12 noon that’s the plan.

I don’t want to loose her friendship under any circumstances.

Design a site like this with WordPress.com
Get started