CopyPastor

Detecting plagiarism made easy.

Score: 0.805147647857666; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2022-05-27
by Shelcy

Original Post

Original - Posted on 2017-03-10
by Анураг Пракаш



            
Present in both answers; Present only in the new answer; Present only in the old answer;

package BasicChallenges; import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; class Result { /* * Complete the 'countingValleys' function below. * * The function is expected to return an INTEGER. * The function accepts following parameters: * 1. INTEGER steps * 2. STRING path */ public static int countingValleys(int steps, String path) { // Write your code here int sea = 0, counter = 0; boolean above = false, below = false; for (int i = 0; i < steps; i++) { if (path.charAt(i) == 'D') { sea--; } else { sea++; } if (sea > 0) { above = true; if (below) { below = false; counter++; } } if (sea < 0) { below = true; if (above) { above = false; } } if (sea == 0 && below) { below = false; counter++; } } return counter; } } public class CountValley { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH"))); int steps = Integer.parseInt(bufferedReader.readLine().trim()); String path = bufferedReader.readLine(); int result = Result.countingValleys(steps, path); bufferedWriter.write(String.valueOf(result)); bufferedWriter.newLine(); bufferedReader.close(); bufferedWriter.close(); } }

If you are writing React-Native class with ES6, following format will be followed. It includes life cycle methods of RN for the class making network calls.
<!-- language: lang-js -->
import React, {Component} from 'react'; import { AppRegistry, StyleSheet, View, Text, Image ToastAndroid } from 'react-native'; import * as Progress from 'react-native-progress'; export default class RNClass extends Component{ constructor(props){ super(props); this.state= { uri: this.props.uri, loading:false } } renderLoadingView(){ return( <View style={{justifyContent:'center',alignItems:'center',flex:1}}> <Progress.Circle size={30} indeterminate={true} /> <Text> Loading Data... </Text> </View> ); } renderLoadedView(){ return( <View> </View> ); } fetchData(){ fetch(this.state.uri) .then((response) => response.json()) .then((result)=>{ }) .done(); this.setState({ loading:true }); this.renderLoadedView(); } componentDidMount(){ this.fetchData(); } render(){ if(!this.state.loading){ return( this.renderLoadingView() ); } else{ return( this.renderLoadedView() ); } } } var style = StyleSheet.create({ });


        
Present in both answers; Present only in the new answer; Present only in the old answer;