Posts

K-Rotate

K-Rotate Given an integer vector and a value k, your task is to rotate the array k times clockwise. Input Format In the function an integer vector and number k is passed. Output Format Return an integer vector. Sample Input { 8, 2, 5, 7, 6}, x = 2 Sample Output { 7,6,8,2,5} Explanation After 1st rotation - { 7,6,8,2,5} After 2nd rotation - { 7,6,8,2,5} Program - #include <iostream> #include <bits/stdc++.h> using namespace std ; vector < int > kRotate ( vector < int > a , int k ){     // Using second vector (array) solution         int l = a . size ();     k = k % l ;     vector < int > out ;     for ( int i = l - k ; i < l ; i ++){         out . push_back ( a [ i ] );     }         for ( int i = 0 ; i < l - k ; i ++){         out . push_back ( a [ i ] );     }     return out ; } vector < int > kRotate2 ( vector < int > a , int k ){     // same memory solution         int l = a . size ();     k = k % l ;     reverse (

Smart Monitoring System

Image
THINGS USED IN THIS PROJECT Hardware components: 1.Raspberry Pi Zero 2. Humidity and Temperature Sensor 3.TSL2561 Digital Luminosity/Lux/Light Sensor     Breakout 4.Microphone Amplifier - MAX4466 with   Adjustable Gain 5.MPL3115A2 - I2C Barometric      Pressure/Altitude/Temperature Sensor 6.MCP3008 - 8-Channel 10-Bit ADC With SPI Interface Software apps Amazon Web Services AWS IoT Project Description The goal is to build a small and easy to use device to monitor temperature, humidity, noise levels, luminosity and atmospheric pressure. The  idea is to have multiple devices spread across the city to send environmental data to the AWS IoT platform for processing and analysis. With this real time data , new public services could be offered, for example: Trigger alarms in case of dangerous measurements detected Finding out the less polluted places in the city at a given time: parks, squares or any public outdoors places. Find out high polluted places to avoid