Category "logic"

Hive query to find conversion ratio

I am trying this query in Hive and it's not working. select ( ( select count(*) from click_streaming where page_

Python Script To Continually Run (Better)

The below script is a working prototype of a script that runs on a rasberry pi and its job is to grab files from a specified folder on a flashdrive when plugged

States Matching Logic Corda

We need a logic for the following scenario: Say for example, we have three parties, Party A, B and C. We have two states, state X and state Y. Party A, and Part

How do I best control activity flow?

I am tasked with building an app that does not have a fixed screen order. When started the app will contact a server an get a list of actions to perform. So one

Combine Pagination of Two Different Entities With different size

I'm working on a problem where i have to do pagination of two data lists. ex. psudo code int recordsPerPage = 100; // this is dynamic int currentPage = 1; // th

Activity Conditional Flow

I have a movie ticket booking app. My initial activity is the login activity where there is a "continue as guest" option in case he doesn't want to sign in or r

Program to reverse a number without using an array

This is the code that I used. It works perfectly, but I don't understand why it works. I just kept changing my original logic until I started using -1 in the co

Infinite Loop when a character is entered [duplicate]

I am trying to restrict the user to enter only '1' or '2'. int ch; do { cout<<"Enter: \n"; cin>>ch; switch(ch) {

What is the correct input to have the program print the sentence: Exactly! Good Job

Read and understand the following code. Provide the correct input to have the program print the sentence: Exactly! Good Job. Before submitting your answer, plea

Generate all contiguous sequences from an array

There's an array say [1,2,4,5,1]. I need to print all the contiguous sub-arrays from this. Input: [1,2,4,5,1] Output: 1 1,2 1,2,4 1,2,4,5 1,2,4,5,1 2

Testing login flow with RSpec in Rails app

I'm using RSpec to test controller behavior in rails. One of the expectations I have is the following scenario: User attempts to access a protected (requires l

Date Diff By Ignoring Leap Days

Please share some logic to find date difference between two dates which would ignore leap days, c# Subtract method includes the leap days. E.g. for startDat= 26

What is the logic behind calculating diagonals on a chessboard?

Given the position of a Bishop on an 8 * 8 chessboard, the task is to count the total number of squares that can be visited by the Bishop in one move. The posit

Android Game Activity Flow - Back to Start

I am looking for the best way in which you would setup navigation in an Android game; a best practice for Android Game Activity Navigation. I have the following