Found 26504 Articles for Server Side Programming

Check if the given String can be split only into subsequences ABC

Prabhdeep Singh
Updated on 16-May-2023 13:28:41

267 Views

A subsequence of a string means part of a string in which characters can be taken from anywhere of the string (zero or more elements) without changing the order of the characters and forming a new string. In this problem, we have given a string of length N where every character of the string belongs to either ‘A’, ‘B’, or ‘C’ character. Our task is to find that the string can be split only into subsequences “ABC” or Not. If the string is split only into subsequences “ABC” then return “yes” otherwise return “no”. Input 1: str = “AABCBC” ... Read More

Check if the Decimal representation of the given Binary String is divisible by K or not

Prabhdeep Singh
Updated on 16-May-2023 12:36:08

598 Views

A binary string is a string that consists of only two different types of characters and that is ‘0’ and ‘1’, hare base is 2. And a decimal representation means each digit is lie between ‘0’ to ‘9’, here the base is 10. Here we have given a string of binary numbers and an integer k. we have to check if the decimal representation of the given binary string is divisible by k or not. If it is divisible then we have to return ‘yes’ otherwise return ‘no’. In the conversion of binary to decimal, we convert a base 2 ... Read More

Maximize the sum of selected numbers from an array to make it empty

Prabhdeep Singh
Updated on 16-May-2023 12:31:26

197 Views

We will be given an array and have to choose an element from it and add that element to the sum. After adding that element to the sum, we have to remove three elements from the array if they exist current number, current number -1, and current number + 1. By this method we will make the array empty and will get a sum. At the end, we have to make the sum maximum. Input: [ 1, 2, 3] Output: 4 Explanation At first, we can have three moves, delete 1, 2, or 3. Let ... Read More

How to Upload Image into Database and Display it using PHP

Tarun Singh
Updated on 14-Jul-2023 15:57:52

16K+ Views

In modern web applications, it is common to store images in databases for various reasons, such as security, easy management, and scalability. PHP, being a popular server-side scripting language, provides an easy way to upload images to databases and display them on the web pages. In this article, we will learn How to Upload Image into Database and Display it using PHP. PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open-source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. In the below article, we have demonstrated the examples with the ... Read More

Python Program to Append an Element Into an Array

Gireesha Devara
Updated on 15-May-2023 17:08:11

2K+ Views

An array is a collection of elements of same data type, and each element in the array is identified by an index value. It is a simplest data structure and we can easily add or remove elements. Arrays in Python Python does not have a specific data structure to represent arrays. Here, we can use List an array. [9, 3, 1, 6, 9] We can use array or NumPy module to work with arrays in python. array('i', [1, 2, 3, 4]) The above array is the integer Array which is defined by the array module. In ... Read More

Python Program to Iterate Over an Array

Gireesha Devara
Updated on 15-May-2023 17:05:59

681 Views

An array is a data structure consisting of a set of elements (values) of the same data type, each element is identified by an index value. And the elements can be directly accessed by using their index numbers. Arrays in Python Python does not have a native array data structure. Instead, we can use the list data structure, NumPy, or array modules. Here we will use list an array − [10, 4, 11, 76, 99] 0 1 2 3 4 The ... Read More

Python Program to Find Common Elements in Two Arrays

Gireesha Devara
Updated on 15-May-2023 16:55:25

7K+ Views

An array is a data structure consisting of a collection of elements of same data type, and each element is identified by an index. [2, 4, 0, 5, 8] 0 1 2 3 4 The integers 2, 4, 0, 5, 8 are the array elements and 0, 1, 2, 3, 4 are the respective index values of the array elements. In The article below, we will discuss the python program to find common elements between two arrays. Input Output Scenarios Assuming we have two arrays A and B. And the resultant ... Read More

Maximum distance between two points in coordinate plane using Rotating Caliper’s Method

Tapas Kumar Ghosh
Updated on 24-Jul-2023 10:10:32

263 Views

In C++ we have a predefined function sqrt that returns the square root of any number. The Rotating Caliper’s Method is the technique used to solve the algorithmic or computational geometry. Visual Representation of Rotating Caliper’s MethodThe hand rotation shows the real example of a rotating caliper graph, whenever the hand rotates the perpendicular direction is shown. We can also understand this concept by using a polygon shape. In this article, we are going to find the maximum distance of two coordinate points using Rotating Caliper’s Method. Syntax The following syntax used in the program − vector name ... Read More

Python Program To Determine If a Given Matrix is a Sparse Matrix

Gireesha Devara
Updated on 15-May-2023 16:53:11

632 Views

A matrix is a rectangular array where the set of numbers arranged in rows and columns. And it is called as an m X n matrix where m and n are the dimensions. If a matrix contains a very less number of non-zero elements compared to the zero elements then it is called a sparse matrix. [0, 0, 3, 0, 0] [0, 1, 0, 0, 6] [1, 0, 0, 9, 0] [0, 0, 2, 0, 0] The above matrix is 4X5 matrix here most of the numbers are zero. Only a few elements are non-zero so that we can ... Read More

Python Program to Display Upper Triangular Matrix

Gireesha Devara
Updated on 15-May-2023 16:51:03

2K+ Views

A matrix is a two-dimensional array of many numbers arranged in rows and columns. A square matrix (whose rows and columns has same number of elements) has two diagonals. One is the Primary diagonal - located from the top left corner to the bottom right corner of a square matrix. And the second one is the Secondary diagonal - located from the top right to the bottom left corner. For a square matrix if all the elements below the Primary diagonal are zero then it is called the Upper Triangular Matrix. [1, 3, 4] [0, 5, 6] [0, ... Read More

Advertisements