Skip to content

Instantly share code, notes, and snippets.

/**
* Created by crised on 09-11-15.
*/
public class Solution {
public Solution() {
int K = -4, L = 1, M = 2, N = 6, P = 0, Q = -1, R = 4, S = 3;
System.out.println(solution(K, L, M, N, P, Q, R, S));
}
//doesn't pas most tests
import java.util.ArrayList;
import java.util.List;
class Solution {
public int solution(int[] A) {
int n = A.length; //riverLength
class Solution {
public Solution() {
String YES = "{[()()]}";
//String NO = "([)()]";
String NO = ")(";
// System.out.println(solution(YES));
System.out.println(solution(NO));
}
Located on a line are N segments, numbered from 0 to N − 1, whose positions are given in zero-indexed arrays A and B. For each I (0 ≤ I < N) the position of segment I is from A[I] to B[I] (inclusive). The segments are sorted by their ends, which means that B[K] ≤ B[K + 1] for K such that 0 ≤ K < N − 1.
Two segments I and J, such that I ≠ J, are overlapping if they share at least one common point. In other words, A[I] ≤ A[J] ≤ B[I] or A[J] ≤ A[I] ≤ B[J].
We say that the set of segments is non-overlapping if it contains no two overlapping segments. The goal is to find the size of a non-overlapping set containing the maximal number of segments.
For example, consider arrays A, B such that:
A[0] = 1 B[0] = 5
A[1] = 3 B[1] = 6
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MovieSyncAdapter.initializeSyncAdapter(this);
MovieSyncAdapter.syncImmediately(this);
Log.d(LOG_TAG, "onCreate, before setContentView");
setContentView(R.layout.activity_main);
Log.d(LOG_TAG, "onCreate, after setContentView");
View detail_fragment_container_view = findViewById(R.id.detail_fragment_container);
if (detail_fragment_container_view != null)
package telematic.cl.popmovies;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.util.Log;
10-15 11:15:15.028 17831-17831/telematic.cl.popmovies E/ActivityThread: Failed to inflate
10-15 11:15:15.028 17831-17831/telematic.cl.popmovies E/ActivityThread: android.view.InflateException: Binary XML file line #15: Error inflating class fragment
10-15 11:15:15.028 17831-17831/telematic.cl.popmovies E/ActivityThread: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
10-15 11:15:15.028 17831-17831/telematic.cl.popmovies E/ActivityThread: at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
10-15 11:15:15.028 17831-17831/telematic.cl.popmovies E/ActivityThread: at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
10-15 11:15:15.028 17831-17831/telematic.cl.popmovies E/ActivityThread: at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-15 11:15:15.028 17831-17831/telematic.cl.popmovies E/ActivityThread: at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
10-15 11:15:15.028 17831-17831/telematic.cl.popmovies E/Activit
package telematic.cl.popmovies;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
//sw600dp/activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context="telematic.cl.popmovies.MainActivity">
<fragment
android:id="@+id/fragment_forecast"
-- OpenCV modules:
-- To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib stitching superres ts videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: androidcamera dynamicuda java python viz
--
-- GUI:
-- QT: NO
-- GTK+ 2.x: NO
-- GThread : NO