[Question/Problem Statement is the Adapted from HackerRank]
Algorithms/Data Structures — [Problem Solving]
There is a Specific Need for Changes in a List of Usernames. In a given List of Usernames — For Each Username — If the Username can be Modified and Moved Ahead in a Dictionary. The Allowed Modification is that Alphabets can change Positions in the Given Username.
Example
usernames[] = {"Aba", "Cat"}
"Aba" can be Changed to only "Baa" — Hence, It can Never Find a Place Ahead in the Dictionary. Hence, Output will be "NO". "Cat" can be Changed to "Act", "Atc", "Tca", "Tac", "Cta" and Definitely "Act" will Find a Place Before "Cat" in the Dictionary. Hence, Output will be "YES".
[Function Description]
Complete the function possibleChanges in the Editor Below.
possibleChanges has the Following Parameters:
String usernames[n]: An Array of User Names
Returns String[n]: An Array with "YES" or "NO" Based on Feasibility
(Actual Question Says String Array, But Signature is List of Strings)
Constraints
• [No Special Constraints Exist, But Cannot Recall Exactly]
Input Format
"The First Line Contains an Integer, n, the Number of Elements in Usernames.",
"Each Line of the n Subsequent Lines (where 0 < i < n) contains a String usernames[i]."
[Sample Case 0 — Sample Input For Custom Testing]
5
Aba
Cat
Boby
Buba
Bapg
Sungi
Lapg
Acba
Sample Output (Each Should Be on a Separate Line)
NO YES NO YES YES YES YES YES
[Explanation of the Solution]
This is again a Good Question from Hacker Rank to Test Your Logic / Problem Solving Abilities. The Core Point to Handle is that For Each
Combination of 2 Alphabets that Exists in the Username String > We Need to Check if the Latter Occurring Character (ASCII) is Less than the Former Occurring Character (ASCII). For Example in the String "Bapg" — For a Selection of "Ba" from "Bapg" — We have "a" Occurring Before "B" in the English Alphabet. We can Have Two Loops (One Nested) to Decide for a Combination of Each Two Alphabets. The Time Complexity of this Solution is O(n^2).
[Source Code, Sumith Puri (c) 2021 — Free to Use and Distribute]
The goal of artificial intelligence is to create a machine that can mimic a human mind and to do that, of course, it needs learning capabilities. However, it is more than just about learning. It’s about reasoning, knowledge representation, and even things like abstract thinking.
Machine learning, on the other hand, is solely focused on writing software that can learn from past experiences. One thing you might find astounding is that machine learning is more closely related to data mining and statistics than it is to AI. Why is that? First, we need to know what we mean by machine learning.
Deep Reinforcement Learning is a somewhat new field within Machine Learning or Artificial Intelligence (you may pick your favorite term between these two, even if they’re not strictly the same), which combines Deep Learning and Reinforcement Learning and is based on the general idea that an agent can learn by observing its actions and their consequences. No, it is not a return to John B. Watson and B. F. Skinner’s behavioral psychology. We are talking, instead, about a set of pretty advanced machine learning algorithms that, when properly mastered, allow computers to achieve remarkable results in some complex tasks. That’s what this book is about, so let’s dive in…
Book Structure and Contents
Foundations of Deep Reinforcement Learning - Theory and Practice in Python begins with a brief preliminary chapter, which serves to introduce a few concepts and terms that will be used throughout all the other chapters: agent, state, action, objective, reward, reinforcement, policy, value function, model, trajectory, transition.
This article analyzes the adjacency matrix used for storing node-link information in an array. For a Graph BFS (Breadth-first-search) traversal, we normally tend to keep an adjacency matrix as a 2D array (adj[][]
) or array of linkedLists
as LinkedList[]. As a result, if an element X is added before element Y, it appears in BFS traversal accordingly. BFS traversal becomes like: ~X,Y,~. What if, the appearance of elements within a breath of a graph needs to be traversed according to some priority or any rule!!
Say in a breath if Priority of Y > Priority of X, element Y should occur before X in BFS traversal. Say In a breath if Y is added later the X, Y should occur before X in traversal.
Nowadays, information security is the main concern on the Internet. With web data continuously flowing from one end to another, to ensure data security, there are many procedures that must be implemented. Different organizations are working to find a more secure way to protect data.
There are also some key terms when it comes to information security — like confidentiality, integrity, availability, etc. Confidentiality means that only authorized users can gain access to sensitive data. Integrity confirms that data has not been modified by any mid-level person. Additionally, this means that the data reached the other user without changes or a breach. Lastly, availability means that data is available for any authorized user. There are many procedures that confirm data confidentiality, integrity, and availability. Almost all procedures use some type of encryption/decryption algorithm to keep data secure from middle attacks. And there are two kinds of security algorithms: symmetric algorithms (use the same secret key to encrypt/decrypt data) and asymmetric algorithms (use different secret keys to encrypt/decrypt data). The main goal of this article is to describe DES algorithm and how it secures data.
In an earlier blog post, I wrote about how breaking problems down into a MapReduce style approach can give you much better performance. We’ve seen that Citus is orders of magnitudes faster than single node databases when we’re able to parallelize the workload across all the cores in a cluster. And while count (*)
and avg
is easy to break into smaller parts, I immediately got the question what about count distinct or the top from a list or median.
Exact distinct count is admittedly harder to tackle in a large distributed setup because it requires a lot of data shuffling between nodes. Count distinct is indeed supported within Citus, but at times can be slow when dealing with especially larger datasets. Median across any moderate to large size dataset can become completely prohibitive for end users. Fortunately, for nearly all of these, there are approximation algorithms that provide close-enough answers and do so with impressive performance characteristics.
Here's an oversimplified survey of cryptographic hash functions: everyone used to use MD5, now they use some variation on SHA.
There's some truth to that. MD5 was very popular and remains popular years after it was proven insecure. And now, variations on SHA like SHA1 and SHA256 are commonly used. But there are a lot more cryptographic hash functions in common use.
How long does it take to multiply very large integers? Using the algorithm you learned in elementary school, it takes O(n²) operations to multiply two n digit numbers. But for large enough numbers it pays to carry out multiplication very differently, using FFTs.
If you’re multiplying integers with tens of thousands of decimal digits, the most efficient algorithm is the Schönhage-Strassen algorithm, which takes
If you have been programming for some time and looking to learn to program then you might be thinking about what makes a good programmer. What can a computer science graduate do to prepare for a career in software development and programming? The things expected of a junior developer are some of the common questions I receive from many students on Facebook and Emails who follows me. These are mostly college students who now have access to a wealth of information thanks to the internet and eager to learn things in advance to prepare for their programming job interviews.
In this article, I'll share 10 things which I believe every programmer should know. This includes a programming language like C++ or Java, essential computer science concepts like data structures, algorithms and computer networking basics, essential tools like Git, Microsoft Word and Excel, skills like SQL and UNIX, editors like Eclipse or Visual Studio, and text editors.