Posts

Showing posts from September, 2021

Java Super Keyword.

  Super Keyword in java Super Keyword is used to prefer parent class during inheritance.  Super is used in two scenario:::::::: 1. Use with variables. class Animal { public int weigth = 130; } class Height extends Animal { public int weight = 200; public void display(){ System.out.println("Weight = "+super.weight); } } class Driver { public static void main(String args[]) {   Height obj = new Height();    obj.display(); } }

Java Script loop

  To iterate over array elements...... 1. var array=[1,3,2,5,8,9]; for(var index=0; index < array.length; ++index){     console.log(array[index]); } 2.  var i=0; array = [10,50,20,80,30]; while(i<array.length) {    console.log(array[i]);     ++i; } 3. index=0; array=[80,81,82,83,84,85,89]; (7) [80, 81, 82, 83, 84, 85, 89] square =x => Math.pow(x,2); x => Math.pow(x,2) squares = array.map(square); (7) [6400, 6561, 6724, 6889, 7056, 7225, 7921] console.log(array); VM1547:1 (7) [80, 81, 82, 83, 84, 85, 89] console.log(squares);

Alphabetic String.....

  Program of Alphabetic String in codeforces.......... void solve(){ string s;  cin>>5;  deque<char>dq  char maxi='a';  for(int i=0;i<(int)s.size(); i++) { maxi=max(maxi,s[i]);  dq.push_back(s[i]); } for(char ch = maxi;ch>='a';ch--)  {  if(dq.size()==0) { cout<<"NO"<<"\n";  Return; } if (dq. front() == ch) dq pop_front();  else if(dq.back() == ch) dq.pop_back(); else{ cout<<"NO"<<"\n";  Return; } } if(dq.size()==0)  cout<<"YES"<<"\n";  else  cout<<"NO"<<"\n"; }

Select SQL

Image
 Query the   NAME   field for all American cities in the   CITY   table with populations larger than   120000 . The   CountryCode   for America is   USA . The  CITY  table is described as follows: SELECT NAME  FROM CITY  WHERE Population > 120000 AND CountryCode = 'USA' ;

SQl.....(Structured query language)

Image
   SQL Series........ Query from Table of GEEKS For GEEKS ....... SELECT *  FROM CITY WHERE POPULATION > 100000 AND COUNTRYCODE = 'USA'; 1. Create Table in SQL: CREATE TABLE Table_name (    column_name data_type;     column_name data_type;   ); Data_types in SQL :::: -- integer --Varchar(limit) 2. Select in SQL -- SELECT (data- *, column_name) FROM (table_name)  -- use WHERE for Condition ....... Like :  SELECT * FROM Table WHERE (condition)....

Array using List

 Implementation of list using array ***  Here  is the code *** #include<bits/stdc++.h> #include<stdio.h> #define SIZE 6 using namespace std; int main() { int array[SIZE],index,item,i; cout<<"Enter the elements in array\n"; for(int i=0; i<SIZE-1; ++i) { scanf("%d",&array[i]); } for(int i=0; i<SIZE; ++i){ cout<<array[i]<<"\t"; } cout<<"\n"; // for(int i=6-1; i>=n; --i) // arra[i] = arra[i]; // arra[i+1]=item; // // for(int i=0; i<6; ++i){ // cout<<arra[i]<<"\t"; // }     cout<<"Enter the index you want to enter item"<<"\n";     cin>>index;     cout<<"Enter the item to put"<<"\n";     cin>>item;     // we track item from back to left.....     for(i = SIZE-2; i>=index; --i)         array[i+1] = array[i];     array[i+1] = item; cout<<"\n...

Class and object in c++

 Program in Class and Object: #include   < cmath > #include   < cstdio > #include   < vector > #include   < iostream > #include   < algorithm > #include   < cassert > using   namespace   std ; // Write your Student class here class   Student   {      private :      int   score [ 5 ];           public :      void   input ()      {        for ( int   i = 0 ; i < 5 ;++ i )        {            cin >> score [ i ];        }         }      int   calculateTotalScore ()      {          int ...

Class and object in C++

 HEY CHECK THIS ONE ALSO .......... Hacker Rank Class Code Solution............ #include   < iostream > #include   < sstream > #include< string.h > using   namespace   std ; /* Enter code for class Student here. Read statement for specification. */ class   Student   {      public :      int   age ;      string   first_name ,   last_name ;      int   standard ;           public :      void   set_age ( int   a )      {          age   =   a ;      }      void   set_standard ( int   s )      {          standard   =   s ;      ...