Posts

Showing posts from April, 2021

Ansible CLI cheatsheet

Hey everyone, I would like to share some of the basic commands of ansible as I am practising ansible. Well, it is another helpful tool that describes how machines should be configured or what actions should be taken on them (systems).  What is ansible? Ansible is  Cross-platform configuration management tool An open-source software Application deployment tool An intra-service orchestration tool Basically, it is a radically simple IT automation engine. Introduction This cheat sheet-style guide provides a quick reference to CLI commands which are commonly used. Glossary Node :- A system where Ansible is installed and configured to connect to other systems. Inventory File :-  A file that contains information about the servers Ansible controls, typically located at /etc/ansible/hosts Playbook :- A YML file containing a series of tasks to be executed on a remote server. Role :- A collection of playbooks and other files that are relevant to a goal such as insta...

Special Sum of array

Level EASY Given an array of length N, which contains single digit elements at every index. You need to find and return the sum of all elements of the array. But the final sum should also be single digit. In order to keep the output single digit - you need to keep adding the output number digits till single digit is left. Input Format : Line 1 : An Integer N i.e. size of array Line 2 : N integers which are elements of the array, separated by spaces Output Format : Single digit sum Constraints : 1 <= N <= 10^6 Sample Input 1 : 3 9 9 9 Sample Output 1 : 9 Sample Output Explanation : 9 + 9 + 9 = 27 2 + 7 = 9 Hence, ans is 9. Sample Input 2 : 5 1 7 8 5 9 Sample Output 1 : 3 Sample Output Explanation : 1 + 7 + 8 + 5 + 9 = 30 3 + 0 = 3 Hence, ans is 3

Chef and Dice Problem Code: SDICE

Read problem statements in   Bengali ,   Mandarin Chinese ,   Russian , and   Vietnamese   as well. Chef has   N   6-sided standard dice . Each die has dimensions   1 × 1 × 1 . Since Chef is bored during the quarantine, he decides to stack dice for fun. First, Chef forms four vertical stacks of dice (not necessarily with the same height; empty stacks are allowed) on his table, which together make up a pile of dice with base area up to   2 × 2 . Among all such structures, the total visible surface area of Chef's structure must be the smallest possible.   Then, Chef calculates the number of   pips   on the visible faces of all dice in the structure. A face of a die is visible if it does not touch the table or another die. Now, he is wondering: among all possible arrangements of dice, what is the maximum possible total number of visible pips? Since he is busy cooking, he is asking you to solve this. Input The first line of the inp...

Strong Language Problem Code: SSCRIPT

  Read problem statements in   Bengali ,   Mandarin Chinese ,   Russian , and   Vietnamese   as well. A string is said to be using   strong language   if it contains at least   K   consecutive characters '*'. You are given a string   S   with length   N . Determine whether it uses strong language or not. Input The first line of the input contains a single integer   T   denoting the number of test cases. The description of   T   test cases follows. The first line of each test case contains two space-separated integers   N   and   K . The second line contains a single string   S   with length   N .   Output Print a single line containing the string   "YES"   if the string contains strong language or   "NO"   if it does not (without quotes). You may print each character of each string in uppercase or lowercase (for example, the strings "yEs", "yes", "Y...

Popular posts from this blog

MySQL Multi Source Master Slave Replication using GTID

Access and modify all the resources of our Wiki.js using WikiJS API

How to pass parameters in webhook?